[latex3-commits] [git/LaTeX3-latex3-latex2e] make-robust: Add tests for \MakeRobust (14216d08)

PhelypeOleinik phelype.oleinik at latex-project.org
Wed Aug 26 00:59:45 CEST 2020


Repository : https://github.com/latex3/latex2e
On branch  : make-robust
Link       : https://github.com/latex3/latex2e/commit/14216d08c9ae92dce4f4df21e3093943c23cc363

>---------------------------------------------------------------

commit 14216d08c9ae92dce4f4df21e3093943c23cc363
Author: PhelypeOleinik <tex.phelype at gmail.com>
Date:   Fri Aug 21 22:38:02 2020 -0300

    Add tests for \MakeRobust


>---------------------------------------------------------------

14216d08c9ae92dce4f4df21e3093943c23cc363
 base/testfiles/github-0373.lvt               |  1 +
 base/testfiles/github-0373.tlg               |  9 +++
 base/testfiles/github-robust-0123.luatex.tlg | 84 +++++++++++++++++++++++++++-
 base/testfiles/github-robust-0123.lvt        | 26 +++++++++
 base/testfiles/github-robust-0123.tlg        | 84 +++++++++++++++++++++++++++-
 base/testfiles/github-robust-0123.xetex.tlg  | 84 +++++++++++++++++++++++++++-
 6 files changed, 285 insertions(+), 3 deletions(-)

diff --git a/base/testfiles/github-0373.lvt b/base/testfiles/github-0373.lvt
index 2198b081..933fbc8e 100644
--- a/base/testfiles/github-0373.lvt
+++ b/base/testfiles/github-0373.lvt
@@ -144,5 +144,6 @@
  \expandafter\def\csname par \endcsname{funny \endgraf}%
 \ShowCommand\par}
 
+\ShowCommand\qbezier
 \end{document}
 
diff --git a/base/testfiles/github-0373.tlg b/base/testfiles/github-0373.tlg
index 858421a5..2ed7723b 100644
--- a/base/testfiles/github-0373.tlg
+++ b/base/testfiles/github-0373.tlg
@@ -176,4 +176,13 @@ l. ...\ShowCommand\goodbreak
 <argument> \par  
 l. ...\ShowCommand\par
                       }
+> \qbezier=robust macro:
+->\protect \qbezier  .
+> \qbezier =robust macro:
+->\@protected at testopt \qbezier  \\qbezier  {0}.
+> \\qbezier =\long macro:
+> default #1=0.
+[#1]#2->\bezier {#1}#2.
+<recently read> }
+l. ...\ShowCommand\qbezier
 (github-0373.aux)
diff --git a/base/testfiles/github-robust-0123.luatex.tlg b/base/testfiles/github-robust-0123.luatex.tlg
index 5b091523..5802ce68 100644
--- a/base/testfiles/github-robust-0123.luatex.tlg
+++ b/base/testfiles/github-robust-0123.luatex.tlg
@@ -5,6 +5,88 @@ LaTeX Font Info:    Redeclaring math delimiter \Downarrow on input line ....
 ->\delimiter "322B3AA .
 l. ...\show\Downarrow
 ---------------------------------------
+> \aaa=robust macro:
+->\protect \aaa  .
+> \aaa =\long macro:
+->boo().
+<argument> \aaa  
+l. ...\mrtest{aaa}{{boo()}}
+> \aaa=robust macro:
+->\protect \aaa  .
+> \aaa =\long macro:
+->boo().
+<argument> \aaa  
+l. ...\mrtest{aaa}{{boo()}}
+> \bbb=robust macro:
+->\protect \bbb  .
+> \bbb =\long macro:
+#1->boo(#1).
+<argument> \bbb  
+l. ...\mrtest{bbb}{[1]{boo(#1)}}
+> \bbb=robust macro:
+->\protect \bbb  .
+> \bbb =\long macro:
+#1->boo(#1).
+<argument> \bbb  
+l. ...\mrtest{bbb}{[1]{boo(#1)}}
+> \ccc=robust macro:
+->\protect \ccc  .
+> \ccc =robust macro:
+->\@protected at testopt \ccc  \\ccc  {X}.
+> \\ccc =\long macro:
+> default #1=X.
+[#1]#2->boo(#1,#2).
+<recently read> }
+l. ...\mrtest{ccc}{[2][X]{boo(#1,#2)}}
+> \ccc=robust macro:
+->\protect \ccc  .
+> \ccc =robust macro:
+->\@protected at testopt \ccc  \\ccc  {X}.
+> \\ccc =\long macro:
+> default #1=X.
+[#1]#2->boo(#1,#2).
+<recently read> }
+l. ...\mrtest{ccc}{[2][X]{boo(#1,#2)}}
+> \aaa=\long macro:
+->boo().
+<recently read> \aaa 
+l. ...\mruntest{aaa}
+> \aaa =undefined.
+<recently read> \aaa  
+l. ...\mruntest{aaa}
+> \\aaa=undefined.
+<recently read> \\aaa 
+l. ...\mruntest{aaa}
+> \\aaa =undefined.
+<recently read> \\aaa  
+l. ...\mruntest{aaa}
+> \bbb=\long macro:
+#1->boo(#1).
+<recently read> \bbb 
+l. ...\mruntest{bbb}
+> \bbb =undefined.
+<recently read> \bbb  
+l. ...\mruntest{bbb}
+> \\bbb=undefined.
+<recently read> \\bbb 
+l. ...\mruntest{bbb}
+> \\bbb =undefined.
+<recently read> \\bbb  
+l. ...\mruntest{bbb}
+> \ccc=macro:
+->\@protected at testopt \ccc \\ccc {X}.
+<recently read> \ccc 
+l. ...\mruntest{ccc}
+> \ccc =undefined.
+<recently read> \ccc  
+l. ...\mruntest{ccc}
+> \\ccc=\long macro:
+[#1]#2->boo(#1,#2).
+<recently read> \\ccc 
+l. ...\mruntest{ccc}
+> \\ccc =undefined.
+<recently read> \\ccc  
+l. ...\mruntest{ccc}
 ====================================
  Not worth making robust ...
 ====================================
@@ -30,7 +112,7 @@ l. ...\show\Downarrow
 ---------------------------------------
 \LoadClass -> \GenericError {               }{LaTeX Error: Can be used only in preamble}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}
 ---------------------------------------
-\MakeRobust{foo}{bar}{baz} -> \GenericError {               }{LaTeX Error: The control sequence `foo' is undefined!\MessageBreak There is nothing here to make robust}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}{bar}{baz}
+\MakeRobust{foo}{bar}{baz} -> \count@ =\escapechar \escapechar =`\\ \GenericError {               }{LaTeX Error: The control sequence `foo' is undefined!\MessageBreak There is nothing here to make robust}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}\escapechar =\count@ {bar}{baz}
 ---------------------------------------
 \OptionNotUsed -> \GenericError {               }{LaTeX Error: Can be used only in preamble}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}
 ---------------------------------------
diff --git a/base/testfiles/github-robust-0123.lvt b/base/testfiles/github-robust-0123.lvt
index 9afe156a..574d2f85 100644
--- a/base/testfiles/github-robust-0123.lvt
+++ b/base/testfiles/github-robust-0123.lvt
@@ -15,6 +15,32 @@
 \show\Downarrow
 \typeout{---------------------------------------}
 
+% test that \MakeRobust behaves exactly like an
+% after-the-fact \DeclareRobustCommand:
+\def\csshow#1{%
+  \begingroup\expandafter\endgroup\expandafter\show\csname#1\endcsname}
+\def\mrtest#1#2{%
+  \expandafter\newcommand\csname #1\endcsname#2%
+  \expandafter\MakeRobust\csname #1\endcsname
+  \expandafter\ShowCommand\csname #1\endcsname
+  %
+  \expandafter\DeclareRobustCommand\csname R#1\endcsname#2%
+  \expandafter\ShowCommand\csname #1\endcsname}
+\def\mruntest#1{%
+  \expandafter\kernel at make@fragile\csname #1\endcsname
+  \csshow{#1}%
+  \csshow{#1 }%
+  \csshow{\@backslashchar#1}%
+  \csshow{\@backslashchar#1 }}
+
+\mrtest{aaa}{{boo()}}
+\mrtest{bbb}{[1]{boo(#1)}}
+\mrtest{ccc}{[2][X]{boo(#1,#2)}}
+
+\mruntest{aaa}
+\mruntest{bbb}
+\mruntest{ccc}
+
 \OMIT
 \begin{document}
 \TIMO
diff --git a/base/testfiles/github-robust-0123.tlg b/base/testfiles/github-robust-0123.tlg
index 49d223fc..f62c6e75 100644
--- a/base/testfiles/github-robust-0123.tlg
+++ b/base/testfiles/github-robust-0123.tlg
@@ -5,6 +5,88 @@ LaTeX Font Info:    Redeclaring math delimiter \Downarrow on input line ....
 ->\delimiter "322B3AA .
 l. ...\show\Downarrow
 ---------------------------------------
+> \aaa=robust macro:
+->\protect \aaa  .
+> \aaa =\long macro:
+->boo().
+<argument> \aaa  
+l. ...\mrtest{aaa}{{boo()}}
+> \aaa=robust macro:
+->\protect \aaa  .
+> \aaa =\long macro:
+->boo().
+<argument> \aaa  
+l. ...\mrtest{aaa}{{boo()}}
+> \bbb=robust macro:
+->\protect \bbb  .
+> \bbb =\long macro:
+#1->boo(#1).
+<argument> \bbb  
+l. ...\mrtest{bbb}{[1]{boo(#1)}}
+> \bbb=robust macro:
+->\protect \bbb  .
+> \bbb =\long macro:
+#1->boo(#1).
+<argument> \bbb  
+l. ...\mrtest{bbb}{[1]{boo(#1)}}
+> \ccc=robust macro:
+->\protect \ccc  .
+> \ccc =robust macro:
+->\@protected at testopt \ccc  \\ccc  {X}.
+> \\ccc =\long macro:
+> default #1=X.
+[#1]#2->boo(#1,#2).
+<recently read> }
+l. ...\mrtest{ccc}{[2][X]{boo(#1,#2)}}
+> \ccc=robust macro:
+->\protect \ccc  .
+> \ccc =robust macro:
+->\@protected at testopt \ccc  \\ccc  {X}.
+> \\ccc =\long macro:
+> default #1=X.
+[#1]#2->boo(#1,#2).
+<recently read> }
+l. ...\mrtest{ccc}{[2][X]{boo(#1,#2)}}
+> \aaa=\long macro:
+->boo().
+<recently read> \aaa 
+l. ...\mruntest{aaa}
+> \aaa =undefined.
+<recently read> \aaa  
+l. ...\mruntest{aaa}
+> \\aaa=undefined.
+<recently read> \\aaa 
+l. ...\mruntest{aaa}
+> \\aaa =undefined.
+<recently read> \\aaa  
+l. ...\mruntest{aaa}
+> \bbb=\long macro:
+#1->boo(#1).
+<recently read> \bbb 
+l. ...\mruntest{bbb}
+> \bbb =undefined.
+<recently read> \bbb  
+l. ...\mruntest{bbb}
+> \\bbb=undefined.
+<recently read> \\bbb 
+l. ...\mruntest{bbb}
+> \\bbb =undefined.
+<recently read> \\bbb  
+l. ...\mruntest{bbb}
+> \ccc=macro:
+->\@protected at testopt \ccc \\ccc {X}.
+<recently read> \ccc 
+l. ...\mruntest{ccc}
+> \ccc =undefined.
+<recently read> \ccc  
+l. ...\mruntest{ccc}
+> \\ccc=\long macro:
+[#1]#2->boo(#1,#2).
+<recently read> \\ccc 
+l. ...\mruntest{ccc}
+> \\ccc =undefined.
+<recently read> \\ccc  
+l. ...\mruntest{ccc}
 ====================================
  Not worth making robust ...
 ====================================
@@ -30,7 +112,7 @@ l. ...\show\Downarrow
 ---------------------------------------
 \LoadClass -> \GenericError {               }{LaTeX Error: Can be used only in preamble}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}
 ---------------------------------------
-\MakeRobust{foo}{bar}{baz} -> \GenericError {               }{LaTeX Error: The control sequence `foo' is undefined!\MessageBreak There is nothing here to make robust}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}{bar}{baz}
+\MakeRobust{foo}{bar}{baz} -> \count@ =\escapechar \escapechar =`\\ \GenericError {               }{LaTeX Error: The control sequence `foo' is undefined!\MessageBreak There is nothing here to make robust}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}\escapechar =\count@ {bar}{baz}
 ---------------------------------------
 \OptionNotUsed -> \GenericError {               }{LaTeX Error: Can be used only in preamble}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}
 ---------------------------------------
diff --git a/base/testfiles/github-robust-0123.xetex.tlg b/base/testfiles/github-robust-0123.xetex.tlg
index b3239c06..5604932d 100644
--- a/base/testfiles/github-robust-0123.xetex.tlg
+++ b/base/testfiles/github-robust-0123.xetex.tlg
@@ -5,6 +5,88 @@ LaTeX Font Info:    Redeclaring math delimiter \Downarrow on input line ....
 ->\delimiter "322B3AA .
 l. ...\show\Downarrow
 ---------------------------------------
+> \aaa=robust macro:
+->\protect \aaa  .
+> \aaa =\long macro:
+->boo().
+<argument> \aaa  
+l. ...\mrtest{aaa}{{boo()}}
+> \aaa=robust macro:
+->\protect \aaa  .
+> \aaa =\long macro:
+->boo().
+<argument> \aaa  
+l. ...\mrtest{aaa}{{boo()}}
+> \bbb=robust macro:
+->\protect \bbb  .
+> \bbb =\long macro:
+#1->boo(#1).
+<argument> \bbb  
+l. ...\mrtest{bbb}{[1]{boo(#1)}}
+> \bbb=robust macro:
+->\protect \bbb  .
+> \bbb =\long macro:
+#1->boo(#1).
+<argument> \bbb  
+l. ...\mrtest{bbb}{[1]{boo(#1)}}
+> \ccc=robust macro:
+->\protect \ccc  .
+> \ccc =robust macro:
+->\@protected at testopt \ccc  \\ccc  {X}.
+> \\ccc =\long macro:
+> default #1=X.
+[#1]#2->boo(#1,#2).
+<recently read> }
+l. ...\mrtest{ccc}{[2][X]{boo(#1,#2)}}
+> \ccc=robust macro:
+->\protect \ccc  .
+> \ccc =robust macro:
+->\@protected at testopt \ccc  \\ccc  {X}.
+> \\ccc =\long macro:
+> default #1=X.
+[#1]#2->boo(#1,#2).
+<recently read> }
+l. ...\mrtest{ccc}{[2][X]{boo(#1,#2)}}
+> \aaa=\long macro:
+->boo().
+<recently read> \aaa 
+l. ...\mruntest{aaa}
+> \aaa =undefined.
+<recently read> \aaa  
+l. ...\mruntest{aaa}
+> \\aaa=undefined.
+<recently read> \\aaa 
+l. ...\mruntest{aaa}
+> \\aaa =undefined.
+<recently read> \\aaa  
+l. ...\mruntest{aaa}
+> \bbb=\long macro:
+#1->boo(#1).
+<recently read> \bbb 
+l. ...\mruntest{bbb}
+> \bbb =undefined.
+<recently read> \bbb  
+l. ...\mruntest{bbb}
+> \\bbb=undefined.
+<recently read> \\bbb 
+l. ...\mruntest{bbb}
+> \\bbb =undefined.
+<recently read> \\bbb  
+l. ...\mruntest{bbb}
+> \ccc=macro:
+->\@protected at testopt \ccc \\ccc {X}.
+<recently read> \ccc 
+l. ...\mruntest{ccc}
+> \ccc =undefined.
+<recently read> \ccc  
+l. ...\mruntest{ccc}
+> \\ccc=\long macro:
+[#1]#2->boo(#1,#2).
+<recently read> \\ccc 
+l. ...\mruntest{ccc}
+> \\ccc =undefined.
+<recently read> \\ccc  
+l. ...\mruntest{ccc}
 ====================================
  Not worth making robust ...
 ====================================
@@ -30,7 +112,7 @@ l. ...\show\Downarrow
 ---------------------------------------
 \LoadClass -> \GenericError {               }{LaTeX Error: Can be used only in preamble}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}
 ---------------------------------------
-\MakeRobust{foo}{bar}{baz} -> \GenericError {               }{LaTeX Error: The control sequence `foo' is undefined!\MessageBreak There is nothing here to make robust}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}{bar}{baz}
+\MakeRobust{foo}{bar}{baz} -> \count@ =\escapechar \escapechar =`\\ \GenericError {               }{LaTeX Error: The control sequence `foo' is undefined!\MessageBreak There is nothing here to make robust}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}\escapechar =\count@ {bar}{baz}
 ---------------------------------------
 \OptionNotUsed -> \GenericError {               }{LaTeX Error: Can be used only in preamble}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}
 ---------------------------------------





More information about the latex3-commits mailing list.