diff options
author | Andreas Scherer <andreas_tex@freenet.de> | 2023-06-22 16:55:11 +0000 |
---|---|---|
committer | Andreas Scherer <andreas_tex@freenet.de> | 2023-06-22 16:55:11 +0000 |
commit | bd4e5b9b5535b424d9d782a1317eb0df724c45d1 (patch) | |
tree | 0d3b512b27b643138fafafa589c665c70ea0964a /Build/source | |
parent | 9e5525cb5d93e9a202035d1e6440311cbd5eccc4 (diff) |
[CWEB] Run short version of ctwill.test.
In total, this is "test-driven" develpment. :o)
* All three CTWILL macros (ctproofmac, cttwinxmac, and ctwimac) needed
a few modifications. Especially cttwinxmac had a bug since CWEB 4.5.
* ctwill.test was reduced to CTWILL+tools only. It now includes a call
of the ctwill-twinx program as well.
* ctwill-proofsort received some spit and polish. At the end, I had to
use Unicode::Collate->sort() to get stable results from ham.tex.
Perl standard sort (with lowercase conversion) more often than not
flipped 'A' and 'a', resp. 'V' and 'v', in section 4 of ham.tex. Now
the uppercase letters always come after their lowercase counterpart.
git-svn-id: svn://tug.org/texlive/trunk@67437 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ChangeLog | 9 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctproofmac.tex | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/cttwinxmac.tex | 2 | ||||
-rwxr-xr-x | Build/source/texk/web2c/cwebdir/ctwill-proofsort | 16 | ||||
-rwxr-xr-x | Build/source/texk/web2c/cwebdir/ctwill.test | 26 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctwimac.tex | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/tests/index.tex | 45 |
7 files changed, 79 insertions, 23 deletions
diff --git a/Build/source/texk/web2c/cwebdir/ChangeLog b/Build/source/texk/web2c/cwebdir/ChangeLog index 5f11df8984b..2eb6dd2a1b4 100644 --- a/Build/source/texk/web2c/cwebdir/ChangeLog +++ b/Build/source/texk/web2c/cwebdir/ChangeLog @@ -1,3 +1,12 @@ +2023-06-20 Andreas Scherer <https://ascherer.github.io> + + * ctproofmac.tex, + * cttwinxmac.tex, + * ctwimac.tex: Minor fixes, bug in TWINX macros. + * ctwill-proofsort: Avoid provoked user errors. + * ctwill.test, + * tests/index.tex: Shorter test suite, TWINX tested. + 2023-06-21 Karl Berry <karl@freefriends.org> * ctwill-proofsort: 'quotes' for $Revision$. diff --git a/Build/source/texk/web2c/cwebdir/ctproofmac.tex b/Build/source/texk/web2c/cwebdir/ctproofmac.tex index 1111e797050..8cfe39821ea 100644 --- a/Build/source/texk/web2c/cwebdir/ctproofmac.tex +++ b/Build/source/texk/web2c/cwebdir/ctproofmac.tex @@ -115,7 +115,7 @@ \sfcode`;=1500 \pretolerance 200 \hyphenpenalty 50 \exhyphenpenalty 50 \noindent{\let\*=\lapstar\bf\secstar.\quad}} \let\startsection=\stsec -\def\defin#1{\global\advance\ind by 2 \1\&{#1 } } % begin `define' or `format' +\def\defin#1{\global\advance\ind by 2 \1\&{#1 }} % begin `define' or `format' \def\A{\note{See also section}} % xref for doubly defined section name \def\As{\note{See also sections}} % xref for multiply defined section name \def\B{\rightskip=0pt plus 100pt minus 10pt % go into C mode diff --git a/Build/source/texk/web2c/cwebdir/cttwinxmac.tex b/Build/source/texk/web2c/cwebdir/cttwinxmac.tex index e2329fa7344..6865478c14a 100644 --- a/Build/source/texk/web2c/cwebdir/cttwinxmac.tex +++ b/Build/source/texk/web2c/cwebdir/cttwinxmac.tex @@ -226,7 +226,7 @@ \let\ \, % C++ digit separator becomes a little white space \def\$##1{\egroup_{\rm##1}\bgroup}% suffix to constant \def\_{\cdot 10^{\aftergroup}}% power of ten (via dirty trick) - \let\~=\oct \let\^=\hex \let\\=\bin {#1}$}}%$% + \let\~=\oct \let\^=\hex \let\\=\bin #1}$}}%$% \def\U{\note{This code is used in section}} % xref for use of a section \def\Us{\note{This code is used in sections}} % xref for uses of a section \let\V=\lor % logical or diff --git a/Build/source/texk/web2c/cwebdir/ctwill-proofsort b/Build/source/texk/web2c/cwebdir/ctwill-proofsort index fe4ca77c2d7..d99ebdf91da 100755 --- a/Build/source/texk/web2c/cwebdir/ctwill-proofsort +++ b/Build/source/texk/web2c/cwebdir/ctwill-proofsort @@ -8,12 +8,19 @@ use warnings; use File::Basename; use Getopt::Long qw(:config no_ignore_case bundling); use Pod::Usage; +use Unicode::Collate; # We expect a TeX file as the single command-line parameter. my $progname = basename $0; -my $usage = "$progname input_file\ntry --help if you need it.\n"; +my $usage = "Usage: $progname input_file\n"; +if (@ARGV > 1) { + my $first = shift @ARGV; + $usage .= "extra file argument(s): @ARGV\n"; + unshift @ARGV, $first; +} +$usage .= "try --help if you need it.\n"; -die $usage unless scalar @ARGV; +die $usage unless scalar @ARGV == 1; Getopt::Long::GetOptions( 'help|?' => \&help_handler, @@ -29,7 +36,7 @@ sub help_handler { } ## version() sub version { - return '$progname $Revision$ $Date$\n'; + return $progname.' $Revision$ $Date$'."\n"; } my $tex = $ARGV[0]; @@ -38,6 +45,7 @@ open(TEX, $tex) or die "$0: Could not open input file $tex.\n"; my %mini_index; # storage for index entries of a section my $print_index = 0; # do we collect and print a mini-index? +my $collator = Unicode::Collate->new(); # Scroll through the input file and look for blocks like # \mini @@ -56,7 +64,7 @@ foreach my $line (<TEX>) $print_index = 1; %mini_index = (); # reset mini-index storage } elsif ("}\\FI\n" eq $line) { # end of mini-index - foreach my $key (sort {"\L$a" cmp "\L$b"} keys %mini_index) { + foreach my $key ($collator->sort(keys %mini_index)) { print $mini_index{$key}; } $print_index = 0; diff --git a/Build/source/texk/web2c/cwebdir/ctwill.test b/Build/source/texk/web2c/cwebdir/ctwill.test index c52725bc5ab..d72ae1b102f 100755 --- a/Build/source/texk/web2c/cwebdir/ctwill.test +++ b/Build/source/texk/web2c/cwebdir/ctwill.test @@ -5,27 +5,21 @@ testdir=$srcdir/cwebdir/tests -# -# (1) Test the "classic" CTWILL procedure -# -# Prime the pump by running CTWILL twice -CWEBINPUTS=$testdir ./ctwill +lpdf ham ham || exit 1 -CWEBINPUTS=$testdir ./ctwill +lpdf ham ham || exit 1 +# Test CTWILL by running it twice +CWEBINPUTS=$testdir ./ctwill ham ham || exit 1 +CWEBINPUTS=$testdir ./ctwill ham ham || exit 1 # Test CTWILL-REFSORT ./ctwill-refsort < $testdir/ham.ref > ham.sref || exit 1 diff ham.sref $testdir/ham.sref || exit 1 -# -# (2) Test the "proofing" CTWILL procedure -# -CWEBINPUTS=$testdir ./ctwill +P +lpdf ham ham || exit 1 -CWEBINPUTS=$testdir ./ctwill +P +lpdf ham ham || exit 1 +# Test CTWILL-PROOFSORT +# Perl script not available in builddir +$testdir/../ctwill-proofsort ham.tex > ham-sorted.tex || exit 1 +diff ham-sorted.tex $testdir/ham-sorted.tex || exit 1 -# Test CTWILL-PROOFSORT---NOT! -# First, it doesn't show up in Work/texk/web2c/ and -# second, Perl complains about the unresolved $Revision$ and §Date$. -#./ctwill-proofsort ham.tex > ham-sorted.tex || exit 1 -#diff ham-sorted.tex $testdir/ham-sorted.tex || exit 1 +# Test CTWILL-TWINX +./ctwill-twinx ham.tex > index.tex +diff index.tex $testdir/index.tex || exit 1 exit 0 diff --git a/Build/source/texk/web2c/cwebdir/ctwimac.tex b/Build/source/texk/web2c/cwebdir/ctwimac.tex index bcd9a2039e7..d65f5bf1fcc 100644 --- a/Build/source/texk/web2c/cwebdir/ctwimac.tex +++ b/Build/source/texk/web2c/cwebdir/ctwimac.tex @@ -461,7 +461,7 @@ \def\Us{\note{Used in sections}} % crossref for uses of a section \def\I{\par\hangindent 2em}\let\*=* \readsections} -\def\readsections{\input \jobname.sscn} +\def\readsections{\input \jobname.scn} \def\datethis{} \def\datecontentspage{} % To produce only a subset of pages, put the page numbers on separate diff --git a/Build/source/texk/web2c/cwebdir/tests/index.tex b/Build/source/texk/web2c/cwebdir/tests/index.tex new file mode 100644 index 00000000000..aae99635db9 --- /dev/null +++ b/Build/source/texk/web2c/cwebdir/tests/index.tex @@ -0,0 +1,45 @@ +\input cttwinxmac +\I\|{a}\unskip, {\sc HAM}~\[1]. +\I\\{aa}\unskip, {\sc HAM}~\[1], 5, 6, 7. +\I\\{advance}\unskip, {\sc HAM}~\[4], 5, 7. +\I\&{Arc}\unskip, {\sc HAM}~1. +\I\\{arcs}\unskip, {\sc HAM}~1, 3, 5, 6. +\I\\{argc}\unskip, {\sc HAM}~\[1], 2. +\I\\{argv}\unskip, {\sc HAM}~\[1], 2. +\I\\{ark}\unskip, {\sc HAM}~\[4], 5, 7, 8. +\I\|{b}\unskip, {\sc HAM}~\[1]. +\I\\{backtrack}\unskip, {\sc HAM}~\[4], 5. +\I\\{bb}\unskip, {\sc HAM}~\[1]. +\I\\{count}\unskip, {\sc HAM}~\[1], 9. +\I\|{d}\unskip, {\sc HAM}~\[1]. +\I\\{deg}\unskip, {\sc HAM}~\[1], 3, 5, 6. +\I\\{dmin}\unskip, {\sc HAM}~\[1], 3. +\I\\{done}\unskip, {\sc HAM}~\[4], 8. +\I\\{exit}\unskip, {\sc HAM}~2. +\I\\{fprintf}\unskip, {\sc HAM}~2. +\I\|{g}\unskip, {\sc HAM}~\[1]. +\I\&{Graph}\unskip, {\sc HAM}~1. +\I\\{main}\unskip, {\sc HAM}~\[1]. +\I\\{modulus}\unskip, {\sc HAM}~\[1], 2, 9. +\I\\{name}\unskip, {\sc HAM}~1, 9. +\I\\{next}\unskip, {\sc HAM}~1, 3, 5, 6, 7, 8. +\I\\{printf}\unskip, {\sc HAM}~1, 9. +\I\\{restore}\unskip, {\sc HAM}~\[4], 5, 7. +\I\\{restore\_all}\unskip, {\sc HAM}~\[7], 8. +\I\\{restore\_graph}\unskip, {\sc HAM}~1, 2. +\I\\{sscanf}\unskip, {\sc HAM}~2. +\I\\{stderr}\unskip, {\sc HAM}~2. +\I\|{t}\unskip, {\sc HAM}~\[1]. +\I\\{taken}\unskip, {\sc HAM}~\[3], 4, 5, 7, 8. +\I\\{tip}\unskip, {\sc HAM}~1, 5, 6, 7. +\I\\{tmax}\unskip, {\sc HAM}~\[1], 4, 5, 9. +\I\\{try\_next}\unskip, {\sc HAM}~\[4], 8. +\I\|{u}\unskip, {\sc HAM}~\[1]. +\I\|{v}\unskip, {\sc HAM}~\[1]. +\I\\{vert}\unskip, {\sc HAM}~\[4], 5, 6, 8, 9. +\I\&{Vertex}\unskip, {\sc HAM}~1. +\I\\{vertices}\unskip, {\sc HAM}~1, 3, 4, 8, 9. +\I\|{x}\unskip, {\sc HAM}~\[1]. +\I\|{y}\unskip, {\sc HAM}~\[1]. +\I\|{z}\unskip, {\sc HAM}~\[1]. +\fin |