Skip to content

Commit

Permalink
Add (convoluted) test case to test definition locks
Browse files Browse the repository at this point in the history
  • Loading branch information
brucemiller committed Apr 3, 2024
1 parent 064f2ef commit cc81318
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 0 deletions.
6 changes: 6 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,12 @@ t/daemon/api/port.xml
t/daemon/citations.tex
t/daemon/complex/exhaustive.spec
t/daemon/complex/exhaustive.xml
t/daemon/complex/testlocks.spec
t/daemon/complex/testlocks.tex
t/daemon/complex/testlocks.xml
t/daemon/complex/testlocks.sty.ltxml
t/daemon/complex/testlocks-a.sty
t/daemon/complex/testlocks-b.sty.ltxml
t/daemon/document.tex
t/daemon/fatal_100.tex
t/daemon/fatal_misdefined.tex
Expand Down
4 changes: 4 additions & 0 deletions t/daemon/complex/testlocks-a.sty
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

% Ignored attempt to redefine \fooC
\def\fooC{testlocks-a FOO-C}
\RequirePackage{testlocks-b};
12 changes: 12 additions & 0 deletions t/daemon/complex/testlocks-b.sty.ltxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package LaTeXML::Package::Pool;
use strict;
use warnings;
use LaTeXML::Package;

# RE-defintions (allowed)
DefMacro('\fooD', "testlocks-b FOO-D", locked => 1);

# Definition, BUT will be RE-defined by testlocks.sty
DefMacro('\fooE', "testlocks-b FOO-E", locked => 1);

1;
3 changes: 3 additions & 0 deletions t/daemon/complex/testlocks.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
preload = testlocks.sty
source = testlocks.tex
format = xml
16 changes: 16 additions & 0 deletions t/daemon/complex/testlocks.sty.ltxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package LaTeXML::Package::Pool;
use strict;
use warnings;
use LaTeXML::Package;

DefMacro('\fooA', "testlocks FOO-A", locked => 1);
DefMacro('\fooB', "testlocks FOO-B", locked => 1);
DefMacro('\fooC', "testlocks FOO-C", locked => 1);
DefMacro('\fooD', "testlocks FOO-D", locked => 1);

InputDefinitions("testlocks-a", type => 'sty', noltxml => 1);

# This gets defined in testlocks-b.sty.ltxml, input from testlocks-a.sty
DefMacro('\fooE', "testlocks FOO-E", locked => 1);

1;
16 changes: 16 additions & 0 deletions t/daemon/complex/testlocks.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
\documentclass{article}
%\usepackage{testlocks}
% Ignored re-definition
\def\fooB{Locak FOO-B}
\begin{document}
testlocks FOO-A:\fooA

testlocks FOO-B:\fooB

testlocks FOO-C:\fooC

testlocks-b FOO-D:\fooD

testlocks FOO-E:\fooE

\end{document}
23 changes: 23 additions & 0 deletions t/daemon/complex/testlocks.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<?latexml package="testlocks"?>
<?latexml class="article"?>
<?latexml RelaxNGSchema="LaTeXML"?>
<document xmlns="http://dlmf.nist.gov/LaTeXML">
<resource src="LaTeXML.css" type="text/css"/>
<resource src="ltx-article.css" type="text/css"/>
<para xml:id="p1">
<p>testlocks FOO-A:testlocks FOO-A</p>
</para>
<para xml:id="p2">
<p>testlocks FOO-B:testlocks FOO-B</p>
</para>
<para xml:id="p3">
<p>testlocks FOO-C:testlocks FOO-C</p>
</para>
<para xml:id="p4">
<p>testlocks-b FOO-D:testlocks-b FOO-D</p>
</para>
<para xml:id="p5">
<p>testlocks FOO-E:testlocks FOO-E</p>
</para>
</document>

0 comments on commit cc81318

Please sign in to comment.