View | Details | Raw Unified | Return to bug 36190
Collapse All | Expand All

(-)a/xt/find-missing-op-in-forms.t (-4 / +10 lines)
Lines 39-45 for my $file ( @files ) { Link Here
39
    push @errors, sprintf "%s:%s", $file, join (",", @e) if @e;
39
    push @errors, sprintf "%s:%s", $file, join (",", @e) if @e;
40
}
40
}
41
41
42
is( @errors, 0, "The <form> in the following files are missing it's corresponding op parameter (see bug 34478)" )
42
is( @errors, 0, "The <form> in the following files are missing it's corresponding op parameter, or op does not start with 'cud-' (see bug 34478)" )
43
    or diag( Dumper @errors );
43
    or diag( Dumper @errors );
44
44
45
sub catch_missing_op {
45
sub catch_missing_op {
Lines 48-54 sub catch_missing_op { Link Here
48
    my @lines = read_file($file);
48
    my @lines = read_file($file);
49
    my @errors;
49
    my @errors;
50
    return unless grep { $_ =~ m|<form| } @lines;
50
    return unless grep { $_ =~ m|<form| } @lines;
51
    my ( $in_form, $closed_form, $line_open_form, $has_op );
51
    my ( $in_form, $closed_form, $line_open_form, $has_op, $op_value );
52
    my $line_number = 0;
52
    my $line_number = 0;
53
    for my $line (@lines) {
53
    for my $line (@lines) {
54
        $line_number++;
54
        $line_number++;
Lines 58-67 sub catch_missing_op { Link Here
58
        }
58
        }
59
        if ( $in_form && $line =~ m{name="op"} ) {
59
        if ( $in_form && $line =~ m{name="op"} ) {
60
            $has_op = 1;
60
            $has_op = 1;
61
            if ( $line =~ m{value="(.*)"} ) {
62
                $op_value = $1
63
            }
61
        }
64
        }
62
        if ( $in_form && $line =~ m{</form} ) {
65
        if ( $in_form && $line =~ m{</form} ) {
63
            $closed_form = 0;
66
            $closed_form = 0;
64
            unless ($has_op) {
67
            if ($has_op) {
68
                unless ( $op_value =~ m{^cud-} ) {
69
                    push @errors, $line_open_form;
70
                }
71
            } else {
65
                push @errors, $line_open_form;
72
                push @errors, $line_open_form;
66
            }
73
            }
67
            $in_form = 0;
74
            $in_form = 0;
68
- 

Return to bug 36190