From cfae79975e9d7372db694b1c505a7823ff2483c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Fabian=20Kr=C3=BCger?= Date: Sun, 31 Oct 2021 16:06:29 +0100 Subject: [PATCH] Use l3build for testing --- build.lua | 6 +- config-lua.lua | 4 + config-pdf.lua | 33 ++++ testfiles-pdf/test.mlr | 51 ++++++ test_pdf.tex => testfiles-pdf/test.mlt | 2 +- testfiles-pdf/test_pdf.txr | 218 +++++++++++++++++++++++++ testfiles-pdf/test_pdf.xrt | 20 +++ 7 files changed, 332 insertions(+), 2 deletions(-) create mode 100644 config-lua.lua create mode 100644 config-pdf.lua create mode 100644 testfiles-pdf/test.mlr rename test_pdf.tex => testfiles-pdf/test.mlt (91%) create mode 100644 testfiles-pdf/test_pdf.txr create mode 100644 testfiles-pdf/test_pdf.xrt diff --git a/build.lua b/build.lua index f5e1bf1..1485bf5 100644 --- a/build.lua +++ b/build.lua @@ -4,6 +4,10 @@ tdsroot = "lualatex" installfiles = { "luamml-*.lua", "*.sty" } sourcefiles = { "luamml-*.lua", "*.sty", "*.dtx" } stdengine = "luatex" -checkengines = {"luatex"} unpackfiles = { "*.dtx" } typesetexe = "lualatex" + +checkconfigs = { + 'config-lua', + 'config-pdf', +} diff --git a/config-lua.lua b/config-lua.lua new file mode 100644 index 0000000..119e608 --- /dev/null +++ b/config-lua.lua @@ -0,0 +1,4 @@ +testfiledir = "testfiles-lua" +checkengines = {"luatex"} +stdengine = "luatex" +checkruns = 3 diff --git a/config-pdf.lua b/config-pdf.lua new file mode 100644 index 0000000..1fc73e1 --- /dev/null +++ b/config-pdf.lua @@ -0,0 +1,33 @@ +testfiledir = "testfiles-pdf" +checkengines = {"pdftex"} +stdengine = "pdftex" +checkruns = 3 + +test_types = test_types or {} +test_types.tml = { + test = '.xrt', + generated = '.tml', + reference = '.txr', + expectation = '.xre', + rewrite = function(source, result, engine, errlevels) + local file = assert(io.open(source,"rb")) + local content = string.gsub(file:read("*all") .. "\n","\r\n","\n") + file:close() + local new_content = content + -- local new_content = processor(content,...) + local newfile = io.open(result,"w") + newfile:write(new_content) + newfile:close() + end, +} +test_types.mml = { + test = '.mlt', + generated = '.tml', + reference = '.mlr', + expectation = '.mle', + rewrite = function(source, result, engine, errlevels) + return os.execute(string.format('texlua pdfmml.lua "%s" | tidy -xml -indent -wrap -quiet --output-file "%s" -', source, result)) + end, +} + +test_order = {'log', 'pdf', 'tml', 'mml'} diff --git a/testfiles-pdf/test.mlr b/testfiles-pdf/test.mlr new file mode 100644 index 0000000..d0165a8 --- /dev/null +++ b/testfiles-pdf/test.mlr @@ -0,0 +1,51 @@ + + + + ( + ( + 𝑝 + + 𝑞 + ) + + ( + 𝑞 + + 𝑟 + ) + ) + + ( + 𝑝 + + ( + 𝑞 + + 𝑟 + ) + ) + + + + s + i + n + + ( + 𝑥 + ) + + + s + i + n + + ( + 𝑥 + + + 2 + 𝜋 + ) + = + 0 + diff --git a/test_pdf.tex b/testfiles-pdf/test.mlt similarity index 91% rename from test_pdf.tex rename to testfiles-pdf/test.mlt index c125b4e..76a0e75 100644 --- a/test_pdf.tex +++ b/testfiles-pdf/test.mlt @@ -1,6 +1,6 @@ \documentclass{article} \usepackage{amsmath} -\usepackage[files]{luamml-demo} +\usepackage{luamml-demo} \begin{document} \[ diff --git a/testfiles-pdf/test_pdf.txr b/testfiles-pdf/test_pdf.txr new file mode 100644 index 0000000..c203661 --- /dev/null +++ b/testfiles-pdf/test_pdf.txr @@ -0,0 +1,218 @@ +LUAMML_INSTRUCTION:REGISTER_MAPPING:2:oms +LUAMML_INSTRUCTION:REGISTER_MAPPING:1:oml +LUAMML_INSTRUCTION:REGISTER_MAPPING:3:omx +LUAMML_MARK:1:count=3,nucleus=true,core={[0]='mi','\u{22a7}'}, +LUAMML_MARK_END +LUAMML_FORMULA_BEGIN:1:3:mrow: + + + +### display math mode entered at line 6 +\mathord +.\fam2 ; +\write3{LUAMML_MARK_REF:1:} +\mathrel +.\fam2 j +\mathrel +.\mkern-3.0mu +\mathrel +.\fam0 = +\mathopen +.\fam0 ( +\mathopen +.\fam0 ( +\mathord +.\fam1 p +\mathrel +.\fam2 ) +\mathord +.\fam1 q +\mathclose +.\fam0 ) +\mathrel +.\fam2 ) +\mathopen +.\fam0 ( +\mathord +.\fam1 q +\mathrel +.\fam2 ) +\mathord +.\fam1 r +\mathclose +.\fam0 ) +\mathclose +.\fam0 ) +\mathrel +.\fam2 ) +\mathopen +.\fam0 ( +\mathord +.\fam1 p +\mathrel +.\fam2 ) +\mathopen +.\fam0 ( +\mathord +.\fam1 q +\mathrel +.\fam2 ) +\mathord +.\fam1 r +\mathclose +.\fam0 ) +\mathclose +.\fam0 ) + +### vertical mode entered at line 0 +### current page: +\write-{} +\glue(\topskip) 10.0 +\hbox(0.0+0.0)x345.0, glue set 330.0fil +.\hbox(0.0+0.0)x15.0 +.\penalty 10000 +.\glue(\parfillskip) 0.0 plus 1.0fil +.\glue(\rightskip) 0.0 + +total height 10.0 + goal height 550.0 + +prevdepth 0.0, prevgraf 1 line + + +! OK +LUAMML_FORMULA_END +LUAMML_FORMULA_BEGIN:2:3:mrow: + + + +### math mode entered at line 18 +\mathop\nolimits +.\kern 0.0 +.\mathord +..\fam0 s +.\mathord +..\fam0 i +.\mathord +..\fam0 n +\mathopen +.\fam0 ( +\mathord +.\fam1 x +\mathclose +.\fam0 ) +\mathbin +.\fam2 ^^@ +\mathop\nolimits +.\kern 0.0 +.\mathord +..\fam0 s +.\mathord +..\fam0 i +.\mathord +..\fam0 n +\mathopen +.\fam0 ( +\mathord +.\fam1 x +\mathbin +.\fam0 + +\mathord +.\fam0 2 +\mathord +.\fam1 ^^Y +\mathclose +.\fam0 ) +\mathrel +.\fam0 = +\mathord +.\fam0 0 + +### horizontal mode entered at line 18 +\hbox(0.0+0.0)x15.0 +\OT1/cmr/m/n/10 E +\OT1/cmr/m/n/10 s +\glue 3.33333 plus 1.66666 minus 1.11111 +\OT1/cmr/m/n/10 g +\OT1/cmr/m/n/10 i +\OT1/cmr/m/n/10 l +\OT1/cmr/m/n/10 t +\glue 3.33333 plus 1.66666 minus 1.11111 + +spacefactor 1000 +### vertical mode entered at line 0 +### current page: +\write-{} +\glue(\topskip) 10.0 +\hbox(0.0+0.0)x345.0, glue set 330.0fil +.\hbox(0.0+0.0)x15.0 +.\penalty 10000 +.\glue(\parfillskip) 0.0 plus 1.0fil +.\glue(\rightskip) 0.0 +\penalty 10000 +\glue(\abovedisplayshortskip) 0.0 plus 3.0 +\glue(\baselineskip) 4.5 +\hbox(7.5+2.5)x185.77597, shifted 79.61201, display +.\OMS/cmsy/m/n/10 ; +.\write3{LUAMML_MARK_REF:1:} +.\glue(\thickmuskip) 2.77771 plus 2.77771 +.\OMS/cmsy/m/n/10 j +.\hbox(0.0+0.0)x-1.66663 +..\kern -1.66663 +.\OT1/cmr/m/n/10 = +.\glue(\thickmuskip) 2.77771 plus 2.77771 +.\OT1/cmr/m/n/10 ( +.\OT1/cmr/m/n/10 ( +.\OML/cmm/m/it/10 p +.\glue(\thickmuskip) 2.77771 plus 2.77771 +.\OMS/cmsy/m/n/10 ) +.\glue(\thickmuskip) 2.77771 plus 2.77771 +.\OML/cmm/m/it/10 q +.\kern0.35878 +.\OT1/cmr/m/n/10 ) +.\glue(\thickmuskip) 2.77771 plus 2.77771 +.\OMS/cmsy/m/n/10 ) +.\glue(\thickmuskip) 2.77771 plus 2.77771 +.\OT1/cmr/m/n/10 ( +.\OML/cmm/m/it/10 q +.\kern0.35878 +.\glue(\thickmuskip) 2.77771 plus 2.77771 +.\OMS/cmsy/m/n/10 ) +.\glue(\thickmuskip) 2.77771 plus 2.77771 +.\OML/cmm/m/it/10 r +.\kern0.27779 +.\OT1/cmr/m/n/10 ) +.\OT1/cmr/m/n/10 ) +.\glue(\thickmuskip) 2.77771 plus 2.77771 +.\OMS/cmsy/m/n/10 ) +.\glue(\thickmuskip) 2.77771 plus 2.77771 +.\OT1/cmr/m/n/10 ( +.\OML/cmm/m/it/10 p +.\glue(\thickmuskip) 2.77771 plus 2.77771 +.\OMS/cmsy/m/n/10 ) +.\glue(\thickmuskip) 2.77771 plus 2.77771 +.\OT1/cmr/m/n/10 ( +.\OML/cmm/m/it/10 q +.\kern0.35878 +.\glue(\thickmuskip) 2.77771 plus 2.77771 +.\OMS/cmsy/m/n/10 ) +.\glue(\thickmuskip) 2.77771 plus 2.77771 +.\OML/cmm/m/it/10 r +.\kern0.27779 +.\OT1/cmr/m/n/10 ) +.\OT1/cmr/m/n/10 ) +\penalty 0 +\glue(\belowdisplayshortskip) 6.0 plus 3.0 minus 3.0 +\glue(\parskip) 0.0 plus 1.0 +\glue(\parskip) 0.0 + +total height 30.5 plus 7.0 minus 3.0 + goal height 550.0 + +prevdepth 2.5 + + +! OK +LUAMML_FORMULA_END +LUAMML_MARK_REF:1: + diff --git a/testfiles-pdf/test_pdf.xrt b/testfiles-pdf/test_pdf.xrt new file mode 100644 index 0000000..76a0e75 --- /dev/null +++ b/testfiles-pdf/test_pdf.xrt @@ -0,0 +1,20 @@ +\documentclass{article} +\usepackage{amsmath} +\usepackage{luamml-demo} + +\begin{document} +\[ + \emptyset\models((p\Rightarrow q)\Rightarrow(q\Rightarrow r))\Rightarrow (p\Rightarrow (q\Rightarrow r)) + \WriteoutFormula +\] + +%\begin{align} +% abc&=def & e^{\mathrm{i}\pi}&=-1\\ +% \Big(1+2&=3\Big)\\ +% &4\\ +% 5 +%\end{align} + +Es gilt $\sin(x)-\sin(x+2\pi)=0\WriteoutFormula$. +\end{document} +