Use l3build for testing

This commit is contained in:
Marcel Fabian Krüger 2021-10-31 16:06:29 +01:00
parent 5b9066eb26
commit cfae79975e
7 changed files with 332 additions and 2 deletions

View File

@ -4,6 +4,10 @@ tdsroot = "lualatex"
installfiles = { "luamml-*.lua", "*.sty" } installfiles = { "luamml-*.lua", "*.sty" }
sourcefiles = { "luamml-*.lua", "*.sty", "*.dtx" } sourcefiles = { "luamml-*.lua", "*.sty", "*.dtx" }
stdengine = "luatex" stdengine = "luatex"
checkengines = {"luatex"}
unpackfiles = { "*.dtx" } unpackfiles = { "*.dtx" }
typesetexe = "lualatex" typesetexe = "lualatex"
checkconfigs = {
'config-lua',
'config-pdf',
}

4
config-lua.lua Normal file
View File

@ -0,0 +1,4 @@
testfiledir = "testfiles-lua"
checkengines = {"luatex"}
stdengine = "luatex"
checkruns = 3

33
config-pdf.lua Normal file
View File

@ -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'}

51
testfiles-pdf/test.mlr Normal file
View File

@ -0,0 +1,51 @@
<math display="block" xmlns:tex="http://typesetting.eu/2021/LuaMathML" xmlns="http://www.w3.org/1998/Math/MathML">
<mi mathvariant="normal" tex:family="2">∅</mi>
<mo lspace="0.278em" rspace="0" tex:class="rel">⊧</mo>
<mo lspace="0.278em" rspace="0" stretchy="false" tex:class="open">(</mo>
<mo lspace="0" rspace="0" stretchy="false" tex:class="open">(</mo>
<mi tex:family="1">𝑝</mi>
<mo lspace="0.278em" rspace="0.278em" stretchy="false" tex:class="rel" tex:family="2">⇒</mo>
<mi tex:family="1">𝑞</mi>
<mo lspace="0" rspace="0" stretchy="false" tex:class="close">)</mo>
<mo lspace="0.278em" rspace="0" stretchy="false" tex:class="rel" tex:family="2">⇒</mo>
<mo lspace="0.278em" rspace="0" stretchy="false" tex:class="open">(</mo>
<mi tex:family="1">𝑞</mi>
<mo lspace="0.278em" rspace="0.278em" stretchy="false" tex:class="rel" tex:family="2">⇒</mo>
<mi tex:family="1">𝑟</mi>
<mo lspace="0" rspace="0" stretchy="false" tex:class="close">)</mo>
<mo lspace="0" rspace="0" stretchy="false" tex:class="close">)</mo>
<mo lspace="0.278em" rspace="0" stretchy="false" tex:class="rel" tex:family="2">⇒</mo>
<mo lspace="0.278em" rspace="0" stretchy="false" tex:class="open">(</mo>
<mi tex:family="1">𝑝</mi>
<mo lspace="0.278em" rspace="0" stretchy="false" tex:class="rel" tex:family="2">⇒</mo>
<mo lspace="0.278em" rspace="0" stretchy="false" tex:class="open">(</mo>
<mi tex:family="1">𝑞</mi>
<mo lspace="0.278em" rspace="0.278em" stretchy="false" tex:class="rel" tex:family="2">⇒</mo>
<mi tex:family="1">𝑟</mi>
<mo lspace="0" rspace="0" stretchy="false" tex:class="close">)</mo>
<mo lspace="0" rspace="0" stretchy="false" tex:class="close">)</mo>
</math>
<math xmlns:tex="http://typesetting.eu/2021/LuaMathML" xmlns="http://www.w3.org/1998/Math/MathML">
<mrow tex:class="opnolimits">
<mi mathvariant="normal">s</mi>
<mi mathvariant="normal">i</mi>
<mi mathvariant="normal">n</mi>
</mrow>
<mo lspace="0" rspace="0" stretchy="false" tex:class="open">(</mo>
<mi tex:family="1">𝑥</mi>
<mo lspace="0" rspace="0" stretchy="false" tex:class="close">)</mo>
<mo lspace="0.222em" rspace="0.222em" tex:class="bin" tex:family="2"></mo>
<mrow tex:class="opnolimits">
<mi mathvariant="normal">s</mi>
<mi mathvariant="normal">i</mi>
<mi mathvariant="normal">n</mi>
</mrow>
<mo lspace="0" rspace="0" stretchy="false" tex:class="open">(</mo>
<mi tex:family="1">𝑥</mi>
<mo lspace="0.222em" rspace="0.222em" tex:class="bin">+</mo>
<mn>2</mn>
<mi tex:family="1">𝜋</mi>
<mo lspace="0" rspace="0" stretchy="false" tex:class="close">)</mo>
<mo lspace="0.278em" rspace="0.278em" tex:class="rel">=</mo>
<mn>0</mn>
</math>

View File

@ -1,6 +1,6 @@
\documentclass{article} \documentclass{article}
\usepackage{amsmath} \usepackage{amsmath}
\usepackage[files]{luamml-demo} \usepackage{luamml-demo}
\begin{document} \begin{document}
\[ \[

218
testfiles-pdf/test_pdf.txr Normal file
View File

@ -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:

View File

@ -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}