Debian Codegraph @

texk/web2c/uptexdir/upbibtex-longline-test.pl

raw
1 #!/usr/bin/env perl
2 #
3 # Public domain. Originally written 2010, Karl Berry.
4 # Check that upbibtex does not break long strings (change in 2010).
5
6 # srcdir = web2c (in the source tree)
7 BEGIN { chomp ($srcdir = $ENV{"srcdir"} || `cd \`dirname $0\`/.. && pwd`); }
8 require "$srcdir/../tests/common-test.pl";
9
10 exit (&main ());
11
12 sub main
13 {
14 # The blg and bbl file names are based on the aux name and cannot be
15 # overridden. We can't write to the aux (source) directory, though,
16 # because that's an absolute path and openout_any=p. Therefore, copy
17 # the input aux file to our working directory and rename it to avoid
18 # spurious parallel test failures.
19 &test_file_copy ("$srcdir/tests/longline.aux", "./uplongline.aux");
20
21 # Run upBibTeX, quit if it fails.
22 my $ret = &test_run ("./upbibtex", "./uplongline.aux");
23 return 1 if $ret != 0;
24
25 # There should be lines longer than 80 chars in the output.
26 # (In older versions of upBibTeX, they are forcibly split, with a %.)
27 local *IN;
28 $IN = "uplongline.bbl";
29 open (IN) || die "open($IN) failed: $!";
30 while (<IN>) {
31 last if length ($_) >= 80;
32 }
33
34 # We failed if all lines were < 80.
35 my $bad = ! (length $_ >= 80);
36 return $bad;
37 }