| 1 |
#! /bin/sh -vx |
| 2 |
# $Id: ctwill.test 68690 2023-10-29 13:15:04Z ascherer $ |
| 3 |
# Copyright 2023 Andreas Scherer <[email protected]> |
| 4 |
# You may freely use, modify and/or distribute this file. |
| 5 |
|
| 6 |
BinDir=${BinDir:-.} |
| 7 |
ExeExt=${ExeExt:-} |
| 8 |
_ctwill=$BinDir/ctwill$ExeExt |
| 9 |
_ctwill_refsort=$BinDir/ctwill-refsort$ExeExt |
| 10 |
_ctwill_twinx=$BinDir/ctwill-twinx$ExeExt |
| 11 |
|
| 12 |
# pre-generated test results in the repository are stored in LF |
| 13 |
# but the output might be written in CRLF on some platform. |
| 14 |
# if 'diff --strip-trailing-cr' is available, exploit it. |
| 15 |
# (useful for tests on win32 binaries run on MSYS shell) |
| 16 |
DIFF="diff" |
| 17 |
$DIFF --strip-trailing-cr $0 $0 \ |
| 18 |
&& DIFF="diff --strip-trailing-cr" || echo |
| 19 |
|
| 20 |
testdir=$srcdir/cwebdir/tests |
| 21 |
|
| 22 |
# Test CTWILL by running it twice |
| 23 |
CWEBINPUTS=$testdir $_ctwill ham ham || exit 1 |
| 24 |
CWEBINPUTS=$testdir $_ctwill ham ham || exit 2 |
| 25 |
diff ham.tex $testdir/ham.tex || exit 3 |
| 26 |
|
| 27 |
# Test CTWILL-REFSORT |
| 28 |
$_ctwill_refsort < $testdir/ham.ref > ham.sref || exit 4 |
| 29 |
$DIFF ham.sref $testdir/ham.sref || exit 5 |
| 30 |
|
| 31 |
# Test CTWILL-TWINX |
| 32 |
$_ctwill_twinx ham.tex > index.tex |
| 33 |
$DIFF index.tex $testdir/index.tex || exit 6 |
| 34 |
|
| 35 |
# Test CTWILL-PROOFSORT |
| 36 |
# Perl script not available in builddir, and requires Unicode::Collate; |
| 37 |
# if that module is not available, just quit testing. |
| 38 |
perl -e 'use Unicode::Collate; Unicode::Collate->new();' 2>/dev/null || exit 0 |
| 39 |
$testdir/../ctwill-proofsort < ham.tex > ham-sorted.tex || exit 7 |
| 40 |
$DIFF ham-sorted.tex $testdir/ham-sorted.tex || exit 8 |
| 41 |
|
| 42 |
exit 0 |