| 1 |
#!/usr/bin/env perl |
| 2 |
# $Id: nested-range-test.pl 77204 2025-12-28 23:06:34Z karl $ |
| 3 |
# Public domain. Originally written 2011, Karl Berry. |
| 4 |
# Check that makeindex doesn't create spurious output from nested ranges. |
| 5 |
# See nested-range.tex and -bb.tex. |
| 6 |
|
| 7 |
# srcdir = makeindexk (in the source tree) |
| 8 |
BEGIN { chomp ($srcdir = $ENV{"srcdir"} || `cd \`dirname $0\`/.. && pwd`); } |
| 9 |
require "$srcdir/../tests/common-test.pl"; |
| 10 |
|
| 11 |
exit (&main ()); |
| 12 |
|
| 13 |
sub main { |
| 14 |
my $IND = "nested-range.ind"; |
| 15 |
|
| 16 |
my @test_args = ("./makeindex", "$srcdir/tests/nested-range.idx", |
| 17 |
"-o", $IND, |
| 18 |
"-t", "nested-range.ilg"); |
| 19 |
my $ret = &test_run (@test_args); |
| 20 |
if ($ret != 0) { |
| 21 |
warn "test_run failed ($ret): $! (cmd=@test_args)\n"; |
| 22 |
die `pwd; ls -lt`; |
| 23 |
} |
| 24 |
|
| 25 |
my $bad = 0; |
| 26 |
|
| 27 |
# Seems that unpredictably the output file doesn't exist yet? |
| 28 |
if (! -e $IND) { |
| 29 |
warn "test_run succeeded, but $IND doesn't exist? (cmd=@test_args)\n"; |
| 30 |
warn `pwd; ls -lt; /l/bin/proc`; |
| 31 |
} |
| 32 |
|
| 33 |
# The test fails if the output contains \(. |
| 34 |
open (IND, $IND) || die "open($IND) failed: $!"; |
| 35 |
while (<IND>) { |
| 36 |
$bad = 1 if /\\\(/; |
| 37 |
} |
| 38 |
close (IND) || die "close($IND) failed: $!"; |
| 39 |
|
| 40 |
return $bad; |
| 41 |
} |