From 39314b5c03d8cbc0fd25b4cc665df2090d75defe Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 8 Mar 2010 18:49:47 +0000 Subject: add longline test for bibtex 0.99d git-svn-id: svn://tug.org/texlive/trunk@17384 c570f23f-e606-0410-a88d-b1316a301751 --- .../texk/web2c/tests/bibtex-longline-test.pl | 38 ++++++++++++++++++++++ .../source/texk/web2c/tests/bibtex-openout-test.pl | 7 ++-- 2 files changed, 42 insertions(+), 3 deletions(-) create mode 100755 Build/source/texk/web2c/tests/bibtex-longline-test.pl (limited to 'Build/source/texk/web2c/tests') diff --git a/Build/source/texk/web2c/tests/bibtex-longline-test.pl b/Build/source/texk/web2c/tests/bibtex-longline-test.pl new file mode 100755 index 00000000000..d800be2ef93 --- /dev/null +++ b/Build/source/texk/web2c/tests/bibtex-longline-test.pl @@ -0,0 +1,38 @@ +#!/usr/bin/env perl +# $Id: bibtex-openout-test.pl 17085 2010-02-18 18:03:18Z karl $ +# Public domain. Originally written 2010, Karl Berry. +# Check that bibtex does not break long strings (change in 2010). + +# srcdir = web2c (in the source tree) +BEGIN { chomp ($srcdir = $ENV{"srcdir"} || `cd \`dirname $0\`/.. && pwd`); } +require "$srcdir/../tests/common-test.pl"; + +exit (&main ()); + +sub main +{ + # The blg and bbl file names are based on the aux name and cannot be + # overridden. We can't write to the aux (source) directory, though, + # because that's an absolute path and openout_any=p. Therefore, copy + # the input files to our working directory. + for my $ext ("aux", "bib") { + &test_file_copy ("$srcdir/tests/longline.$ext", "./longline.$ext"); + } + + # Run BibTeX, quit if it fails. + my $ret = &test_run ("./bibtex", "./longline.aux"); + return 1 if $ret != 0; + + # There should be lines longer than 80 chars in the output. + # (In older versions of BibTeX, they are forcibly split, with a %.) + local *IN; + $IN = "longline.bbl"; + open (IN) || die "open($IN) failed: $!"; + while () { + last if length ($_) >= 80; + } + + # We failed if all lines were < 80. + my $bad = ! (length $_ >= 80); + return $bad; +} diff --git a/Build/source/texk/web2c/tests/bibtex-openout-test.pl b/Build/source/texk/web2c/tests/bibtex-openout-test.pl index 45fd92d1b6f..cc00564e5d3 100755 --- a/Build/source/texk/web2c/tests/bibtex-openout-test.pl +++ b/Build/source/texk/web2c/tests/bibtex-openout-test.pl @@ -3,7 +3,8 @@ # Public domain. Originally written 2010, Karl Berry. # Check that bibtex respects openout_any. -BEGIN { chomp ($srcdir = $ENV{"srcdir"} || `dirname $0`); } +# srcdir = web2c (in the source tree) +BEGIN { chomp ($srcdir = $ENV{"srcdir"} || `cd \`dirname $0\`/.. && pwd`); } require "$srcdir/../tests/common-test.pl"; exit (&main ()); @@ -12,10 +13,10 @@ sub main { $ENV{"openout_any"} = "p"; # should already be in texmf.cnf, but ... - # .blg open of abs path should fail + # .blg open of abs path should fail: my $ret = &test_run ("./bibtex", "$srcdir/exampl.aux"); - # The test fails if the program succeeded. Ideally we'd grep the output. + # The test fails if the program succeeded. Could also check the output. my $bad = ($ret == 0); return $bad; } -- cgit v1.2.3