| 1 |
#!/usr/bin/env perl |
| 2 |
# $Id: bibtex-openout-test.pl 17085 2010-02-18 18:03:18Z karl $ |
| 3 |
# Public domain. Originally written 2010, Karl Berry. |
| 4 |
# Check that bibtex 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. |
| 18 |
&test_file_copy ("$srcdir/tests/longline.aux", "./longline.aux"); |
| 19 |
|
| 20 |
# Run BibTeX, quit if it fails. |
| 21 |
my $ret = &test_run ("./bibtex", "./longline.aux"); |
| 22 |
return 1 if $ret != 0; |
| 23 |
|
| 24 |
# There should be lines longer than 80 chars in the output. |
| 25 |
# (In older versions of BibTeX, they are forcibly split, with a %.) |
| 26 |
local *IN; |
| 27 |
$IN = "longline.bbl"; |
| 28 |
open (IN) || die "open($IN) failed: $!"; |
| 29 |
while (<IN>) { |
| 30 |
last if length ($_) >= 80; |
| 31 |
} |
| 32 |
|
| 33 |
# We failed if all lines were < 80. |
| 34 |
my $bad = ! (length $_ >= 80); |
| 35 |
return $bad; |
| 36 |
} |