From e09dfcdce8628cd8965181fb9c9e11b3ded0bc60 Mon Sep 17 00:00:00 2001 From: rzuckerm Date: Sun, 26 Jan 2025 09:02:12 -0600 Subject: [PATCH 1/2] Modify Tests in Tex --- archive/t/tex/fizz-buzz.tex | 15 ++++++++++----- archive/t/tex/hello-world.tex | 6 +++--- archive/t/tex/testinfo.yml | 32 ++++++++++++++++---------------- 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/archive/t/tex/fizz-buzz.tex b/archive/t/tex/fizz-buzz.tex index 548202570..61a05a077 100644 --- a/archive/t/tex/fizz-buzz.tex +++ b/archive/t/tex/fizz-buzz.tex @@ -1,4 +1,8 @@ -%&pdftex +% Source: https://rosettacode.org/wiki/String_append#Plain_TeX +\def\addtomacro#1#2{\expandafter\def\expandafter#1\expandafter{#1#2}} + +\newwrite\out +\immediate\openout\out=fizz-buzz.txt \countdef\counter=1 \countdef\threecounter=2 @@ -9,22 +13,23 @@ \loop \def\printnum{1} + \def\result{} \noindent \ifnum \threecounter>2 - Fizz% + \addtomacro\result{Fizz} \threecounter=0 \def\printnum{0} \fi \ifnum \fivecounter>4 - Buzz% + \addtomacro\result{Buzz} \fivecounter=0 \def\printnum{0} \fi \ifnum\printnum=1 % print the counter variable - \the\counter% + \addtomacro\result{\the\counter} \fi - \hfil \break + \immediate\write\out{\result} \advance \counter 1 \advance \threecounter 1 \advance \fivecounter 1 diff --git a/archive/t/tex/hello-world.tex b/archive/t/tex/hello-world.tex index c91843198..9ab7d7035 100644 --- a/archive/t/tex/hello-world.tex +++ b/archive/t/tex/hello-world.tex @@ -1,4 +1,4 @@ -%&pdftex - -Hello, World! +\newwrite\out +\immediate\openout\out=hello-world.txt +\immediate\write\out{Hello, World!} \end diff --git a/archive/t/tex/testinfo.yml b/archive/t/tex/testinfo.yml index b672b073d..8965168d2 100644 --- a/archive/t/tex/testinfo.yml +++ b/archive/t/tex/testinfo.yml @@ -4,21 +4,21 @@ folder: container: image: "rzuckerm/tex" - tag: "2019.20200218-1-1" + tag: "2025.01.25-1.17.0-dev" + # sample program must write to a .txt file with same name -- e.g., + # hello-world.tex writes to hello-world.txt # args.txt contains the command line arguments build: | - sh -c '(echo "#!/bin/sh"; \ - echo "if [ \"\$#\" = 0 ];"; \ - echo "then"; \ - echo " touch args.txt"; \ - echo "else"; \ - echo " printf \"%s\\n\" \"\$@\" >args.txt"; \ - echo "fi"; \ - echo "if ! pdftex -halt-on-error -interaction=batchmode {{ source.name }}{{ source.extension }} >/dev/null"; \ - echo "then"; \ - echo " cat {{ source.name }}.log"; \ - echo "else"; \ - echo " pdf2html {{ source.name }}.pdf >{{ source.name }}.html && html2txt {{ source.name }}.html"; \ - echo "fi" \ - ) >{{ source.name }}' - cmd: "sh ./{{ source.name }}" + bash -c ' \ + if [ "$#" = 0 ]; \ + then \ + touch args.txt; \ + else \ + printf "%s\n" "$@" >args.txt; \ + fi; \ + if ! luatex -halt-on-error -interactionmode=batch {{ source.name }}{{ source.extension }}; \ + then \ + cat {{ source.name }}.log; \ + exit 1; \ + fi' + cmd: "cat {{ source.name }}.txt" From 0ce65618b341e3d84898e0e83afb09a6f4086330 Mon Sep 17 00:00:00 2001 From: rzuckerm Date: Mon, 27 Jan 2025 16:59:31 -0600 Subject: [PATCH 2/2] Modify tests in Tex --- archive/t/tex/testinfo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archive/t/tex/testinfo.yml b/archive/t/tex/testinfo.yml index 8965168d2..fd18f779f 100644 --- a/archive/t/tex/testinfo.yml +++ b/archive/t/tex/testinfo.yml @@ -4,7 +4,7 @@ folder: container: image: "rzuckerm/tex" - tag: "2025.01.25-1.17.0-dev" + tag: "2025.01.25-1.17.0-2" # sample program must write to a .txt file with same name -- e.g., # hello-world.tex writes to hello-world.txt # args.txt contains the command line arguments