summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/pdftexdir/tests
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-05-17 21:37:18 +0000
committerKarl Berry <karl@freefriends.org>2018-05-17 21:37:18 +0000
commit35f7fd5d9d549dd4d75f8bb75bc99aac680f3d76 (patch)
tree606e6c384989ad8c2018cba73d2cedf8c7edcca3 /Build/source/texk/web2c/pdftexdir/tests
parent6523183e9bf0cb9c831adaa6eed6cac3b3c9d207 (diff)
new primitive \expanded, pdftex r801, https://mailman.ntg.nl/pipermail/ntg-pdftex/2018-May/004233.html
git-svn-id: svn://tug.org/texlive/trunk@47741 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/pdftexdir/tests')
-rw-r--r--Build/source/texk/web2c/pdftexdir/tests/expanded.tex46
-rw-r--r--Build/source/texk/web2c/pdftexdir/tests/expanded.txt61
2 files changed, 107 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/pdftexdir/tests/expanded.tex b/Build/source/texk/web2c/pdftexdir/tests/expanded.tex
new file mode 100644
index 00000000000..50484cb9533
--- /dev/null
+++ b/Build/source/texk/web2c/pdftexdir/tests/expanded.tex
@@ -0,0 +1,46 @@
+% $Id$
+% Public domain.
+% Originally written 2018 by David Carlisle, Bruno Le Floch.
+
+\catcode`\{=1 \catcode`\}=2 \catcode`\#=6
+\def\typ#1{\immediate\write-1 {#1}}
+\def\space{ }
+\let\bgroup{ \let\egroup}
+
+\typ{START}
+\typ{EXPANDED TEST 1}
+% Check the primitive exists
+\show\expanded
+
+\typ{EXPANDED TEST 2}
+% Simple expansion test
+\def\aaa{x}
+\def\bbb{\aaa\aaa}
+\expandafter\def\expandafter\ccc\expandafter{\expanded{\bbb,\aaa}}
+\show\ccc
+
+\typ{EXPANDED TEST 3: the}
+% Expanding \the
+\typ{\expanded{\bbb,\the\numexpr100+20+3\relax}}
+
+\typ{EXPANDED TEST 4: macro param}
+% Constructed #1 is still #1
+\expandafter\def\expandafter\ddd\expandafter#\expanded{1{#\number--1}}
+\show\ddd
+
+\typ{EXPANDED TEST 5: torture}
+% Torture test from Bruno Le Floch testing various tricky interactions
+\expanded\relax\space\ifincsname \BOOM\fi{\ifincsname \BOOM\fi}
+\showtokens\expandafter{\expanded{#,\noexpand\aaa,\unexpanded{\aaa}}}
+\showtokens\expandafter{\expanded{#,\unexpanded{#}}}
+\showtokens\expandafter{\expanded\expandafter{\noexpand\aaa}}
+\showtokens\expandafter{\expanded\expandafter{\unexpanded{\aaa}}}
+\showtokens\expanded{{\expanded{\aaa\noexpand\aaa\noexpand\noexpand\noexpand\aaa}}}
+\toks0{\aaa}
+\showtokens\expanded{{\the\toks0}}
+\expanded\bgroup\show\egroup}
+\edef\foo{\expanded{##}}
+\show\foo
+
+\typ{END}
+\end
diff --git a/Build/source/texk/web2c/pdftexdir/tests/expanded.txt b/Build/source/texk/web2c/pdftexdir/tests/expanded.txt
new file mode 100644
index 00000000000..d9b7c275c36
--- /dev/null
+++ b/Build/source/texk/web2c/pdftexdir/tests/expanded.txt
@@ -0,0 +1,61 @@
+START
+EXPANDED TEST 1
+> \expanded=\expanded.
+l.13 \show\expanded
+
+
+EXPANDED TEST 2
+> \ccc=macro:
+->xx,x.
+l.20 \show\ccc
+
+
+EXPANDED TEST 3: the
+xx,123
+EXPANDED TEST 4: macro param
+> \ddd=macro:
+#1->#1.
+l.29 \show\ddd
+
+
+EXPANDED TEST 5: torture
+> ##,\aaa ,\aaa .
+l.34 ...panded{#,\noexpand\aaa,\unexpanded{\aaa}}}
+
+
+> ##,##.
+l.35 ...s\expandafter{\expanded{#,\unexpanded{#}}}
+
+
+> \aaa .
+l.36 ...fter{\expanded\expandafter{\noexpand\aaa}}
+
+
+> x.
+l.37 ...{\expanded\expandafter{\unexpanded{\aaa}}}
+
+
+> xx\aaa .
+<inserted text> {xx\aaa }
+
+l.38 ...pand\aaa\noexpand\noexpand\noexpand\aaa}}}
+
+
+> \aaa .
+<inserted text> {\aaa }
+
+l.40 \showtokens\expanded{{\the\toks0}}
+
+
+> \egroup=end-group character }.
+<inserted text> \show \egroup
+
+l.41 \expanded\bgroup\show\egroup}
+
+
+> \foo=macro:
+->##.
+l.43 \show\foo
+
+
+END