tests/runner: fix %else handling
Getting the show state proper for %else and %endif did not properly work
in nested cases.
Follow-up to 3d089c41ea
Closes #11731
This commit is contained in:
parent
629723ecf2
commit
1d2f41a8a3
@ -301,6 +301,7 @@ sub prepro {
|
||||
my @out;
|
||||
my $data_crlf;
|
||||
my @pshow;
|
||||
my @altshow;
|
||||
my $plvl;
|
||||
my $line;
|
||||
for my $s (@entiretest) {
|
||||
@ -317,7 +318,18 @@ sub prepro {
|
||||
$rev ^= $feature{$cond} ? 1 : 0;
|
||||
push @pshow, $show; # push the previous state
|
||||
$plvl++;
|
||||
$show = $rev;
|
||||
if($show) {
|
||||
# only if this was showing before we can allow the alternative
|
||||
# to go showing as well
|
||||
push @altshow, $rev ^ 1; # push the reversed show state
|
||||
}
|
||||
else {
|
||||
push @altshow, 0; # the alt should still hide
|
||||
}
|
||||
if($show) {
|
||||
# we only allow show if already showing
|
||||
$show = $rev;
|
||||
}
|
||||
next;
|
||||
}
|
||||
elsif($s =~ /^ *%else/) {
|
||||
@ -325,7 +337,8 @@ sub prepro {
|
||||
print STDERR "error: test$testnum:$line: %else no %if\n";
|
||||
last;
|
||||
}
|
||||
$show ^= 1;
|
||||
$show = pop @altshow;
|
||||
push @altshow, $show; # put it back for consistency
|
||||
next;
|
||||
}
|
||||
elsif($s =~ /^ *%endif/) {
|
||||
@ -334,6 +347,7 @@ sub prepro {
|
||||
last;
|
||||
}
|
||||
$show = pop @pshow;
|
||||
pop @altshow; # not used here but we must pop it
|
||||
next;
|
||||
}
|
||||
if($show) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user