Bug 36190: Adjust the test

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Jonathan Druart 2024-02-28 14:06:12 +01:00 committed by Katrin Fischer
parent 293d9c66ce
commit f19c721171
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834

View file

@ -39,7 +39,7 @@ for my $file ( @files ) {
push @errors, sprintf "%s:%s", $file, join (",", @e) if @e;
}
is( @errors, 0, "The <form> in the following files are missing it's corresponding op parameter (see bug 34478)" )
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)" )
or diag( Dumper @errors );
sub catch_missing_op {
@ -48,7 +48,7 @@ sub catch_missing_op {
my @lines = read_file($file);
my @errors;
return unless grep { $_ =~ m|<form| } @lines;
my ( $in_form, $closed_form, $line_open_form, $has_op );
my ( $in_form, $closed_form, $line_open_form, $has_op, $op_value );
my $line_number = 0;
for my $line (@lines) {
$line_number++;
@ -58,10 +58,17 @@ sub catch_missing_op {
}
if ( $in_form && $line =~ m{name="op"} ) {
$has_op = 1;
if ( $line =~ m{value="(.*)"} ) {
$op_value = $1
}
}
if ( $in_form && $line =~ m{</form} ) {
$closed_form = 0;
unless ($has_op) {
if ($has_op) {
unless ( $op_value =~ m{^cud-} ) {
push @errors, $line_open_form;
}
} else {
push @errors, $line_open_form;
}
$in_form = 0;