[latex3-commits] [git/LaTeX3-latex3-latex2e] gh373: Add tests for \ShowCommand (19d50d4c)

PhelypeOleinik tex.phelype at gmail.com
Thu Aug 20 18:43:06 CEST 2020


Repository : https://github.com/latex3/latex2e
On branch  : gh373
Link       : https://github.com/latex3/latex2e/commit/19d50d4cbb0494d6dbbc989429f9c81e9b65c1a3

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

commit 19d50d4cbb0494d6dbbc989429f9c81e9b65c1a3
Author: PhelypeOleinik <tex.phelype at gmail.com>
Date:   Thu Aug 20 13:43:06 2020 -0300

    Add tests for \ShowCommand


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

19d50d4cbb0494d6dbbc989429f9c81e9b65c1a3
 .../testfiles/{github-0239.lvt => github-0373.lvt} | 101 ++++++-------
 base/testfiles/github-0373.tlg                     | 160 +++++++++++++++++++++
 2 files changed, 211 insertions(+), 50 deletions(-)

diff --git a/base/testfiles/github-0239.lvt b/base/testfiles/github-0373.lvt
similarity index 55%
copy from base/testfiles/github-0239.lvt
copy to base/testfiles/github-0373.lvt
index 1a4f9fbc..21993a07 100644
--- a/base/testfiles/github-0239.lvt
+++ b/base/testfiles/github-0373.lvt
@@ -10,17 +10,10 @@
 
 \makeatletter
 
-\def\testt#1#2#3#4{%
-  #4%
-  \DeclareCommandCopy#1#3%
-  \testtt#1
-  \expandafter\testtt\csname#2\space\endcsname
-  \expandafter\testtt\csname\string#1\endcsname
-  \expandafter\testtt\csname\string#1\space\endcsname
+\def\test#1#2{%
+  #2%
+  \ShowCommand#1%
   \typeout{}}
-\def\testtt#1{%
-  \typeout{\string#1=\meaning#1|}%
-  \let#1\undefined}
 
 %% etoolbox emulation
 \def\@carsquare#1#2#3\@nil{#1#2}
@@ -44,70 +37,69 @@
   {{\ifrobustcmd\letrobustcmd}}
 %%
 
-\def\cmda{defined}
+\typeout{----------------------------------------}
+\DeclareRobustCommand\foo[1]{bar}
+\ShowCommand\foo
 
-% Here we need control words
-\def\test{\testt\tmp{tmp}}
+\typeout{----- TeX}
+\show\foo
+\expandafter\show\csname foo \endcsname
 
-\test\cmda{\renewcommand\cmda[1][]{boo}}
+\typeout{----------------------------------------}
+\DeclareRobustCommand\foo[1][\zz]{bar}
+\ShowCommand\foo
 
-\test\cmdb{\DeclareRobustCommand\cmdb[1]{boo}}
+\typeout{----- TeX}
+\show\foo
+\expandafter\show\csname foo \endcsname
+\expandafter\show\csname\string\foo\space\endcsname
 
-\test\cmdc{\DeclareRobustCommand\cmdc[1][]{boo}}
+\typeout{----------------------------------------}
+\DeclareRobustCommand*\foo[1]{bar}
+\ShowCommand\foo
 
-\test\cmdd{%
-  \protected\edef\cmdd{\noexpand\@testopt
-    \expandafter\noexpand\csname\string\cmdd\endcsname{}}%
-  \expandafter\def\csname\string\cmdd\endcsname[#1]{boo}}
+\typeout{----- TeX}
+\show\foo
+\expandafter\show\csname foo \endcsname
 
-% And here control symbols
-\def\test{\testt\+{+}}
+\typeout{----------------------------------------}
+\DeclareRobustCommand*\foo[1][\zz]{bar}
+\ShowCommand\foo
 
-\test\!{\renewcommand\![1][]{boo}}
+\typeout{----- TeX}
+\show\foo
+\expandafter\show\csname foo \endcsname
+\expandafter\show\csname\string\foo\space\endcsname
 
-\test\#{\DeclareRobustCommand\#[1]{boo}}
+\typeout{----------------------------------------}
 
-\test\${\DeclareRobustCommand\$[1][]{boo}}
+\def\cmda{defined}
 
-\test\%{%
-  \protected\edef\%{\noexpand\@testopt
-    \expandafter\noexpand\csname\string\%\endcsname{}}%
-  \expandafter\def\csname\string\%\endcsname[#1]{boo}}
+% Here we need control words
+\test\cmda{\renewcommand\cmda[1][\zz]{boo}}
 
+\test\cmdb{\DeclareRobustCommand\cmdb[1]{boo}}
 
+\test\cmdc{\DeclareRobustCommand\cmdc[1][\zz]{boo}}
 
-% Test letting a control symbol to a control word
-\def\test{\testt\tmp{tmp}}
+\test\cmdd{%
+  \protected\edef\cmdd{\noexpand\@testopt
+    \expandafter\noexpand\csname\string\cmdd\endcsname{}}%
+  \expandafter\def\csname\string\cmdd\endcsname[#1]{boo}}
 
-\test\!{\renewcommand\![1][]{boo}}
+% And here control symbols
+\test\!{\renewcommand\![1][\zz]{boo}}
 
 \test\#{\DeclareRobustCommand\#[1]{boo}}
 
-\test\${\DeclareRobustCommand\$[1][]{boo}}
+\test\${\DeclareRobustCommand\$[1][\zz]{boo}}
 
 \test\%{%
   \protected\edef\%{\noexpand\@testopt
     \expandafter\noexpand\csname\string\%\endcsname{}}%
   \expandafter\def\csname\string\%\endcsname[#1]{boo}}
 
-% And a control word to a control symbol
-\def\test{\testt\+{+}}
-
-\test\cmda{\renewcommand\cmda[1][]{boo}}
-
-\test\cmdb{\DeclareRobustCommand\cmdb[1]{boo}}
-
-\test\cmdc{\DeclareRobustCommand\cmdc[1][]{boo}}
-
-\test\cmdd{%
-  \protected\edef\cmdd{\noexpand\@testopt
-    \expandafter\noexpand\csname\string\cmdd\endcsname{}}%
-  \expandafter\def\csname\string\cmdd\endcsname[#1]{boo}}
-
-
 % Test letting other control sequences
-\def\test{\testt\tmp{tmp}}
-
 {%
  \def\testtt#1{%
    \typeout{\string#1=\meaning#1}%
@@ -123,5 +115,14 @@
 
 \test\cmde{\def\cmde#1#2#3#4#5#6#7#8#9{}}
 
+% \newcommand doesn't work with \escapechar-1
+\renewcommand\cmda[1][\zz]{boo}
+
+\escapechar-1
+
+\ShowCommand\cmda
+
+\escapechar92
+
 \end{document}
 
diff --git a/base/testfiles/github-0373.tlg b/base/testfiles/github-0373.tlg
new file mode 100644
index 00000000..a7479ad0
--- /dev/null
+++ b/base/testfiles/github-0373.tlg
@@ -0,0 +1,160 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+----------------------------------------
+> \foo=robust macro:
+->\protect \foo  .
+> \foo =\long macro:
+#1->bar.
+<argument> \foo  
+l. ...\ShowCommand\foo
+----- TeX
+> \foo=macro:
+->\protect \foo  .
+l. ...\show\foo
+> \foo =\long macro:
+#1->bar.
+<recently read> \foo  
+l. ...\expandafter\show\csname foo \endcsname
+----------------------------------------
+LaTeX Info: Redefining \foo on input line ....
+> \foo=robust macro:
+->\protect \foo  .
+> \foo =robust macro:
+->\@protected at testopt \foo  \\foo  {\zz }.
+> \\foo =\long macro:
+> default #1=\zz .
+[#1]->bar.
+<recently read> }
+l. ...\ShowCommand\foo
+----- TeX
+> \foo=macro:
+->\protect \foo  .
+l. ...\show\foo
+> \foo =macro:
+->\@protected at testopt \foo  \\foo  {\zz }.
+<recently read> \foo  
+l. ...\expandafter\show\csname foo \endcsname
+> \\foo =\long macro:
+[#1]->bar.
+<recently read> \\foo  
+l. ......ter\show\csname\string\foo\space\endcsname
+----------------------------------------
+LaTeX Info: Redefining \foo on input line ....
+> \foo=robust macro:
+->\protect \foo  .
+> \foo =macro:
+#1->bar.
+<argument> \foo  
+l. ...\ShowCommand\foo
+----- TeX
+> \foo=macro:
+->\protect \foo  .
+l. ...\show\foo
+> \foo =macro:
+#1->bar.
+<recently read> \foo  
+l. ...\expandafter\show\csname foo \endcsname
+----------------------------------------
+LaTeX Info: Redefining \foo on input line ....
+> \foo=robust macro:
+->\protect \foo  .
+> \foo =robust macro:
+->\@protected at testopt \foo  \\foo  {\zz }.
+> \\foo =macro:
+> default #1=\zz .
+[#1]->bar.
+<recently read> }
+l. ...\ShowCommand\foo
+----- TeX
+> \foo=macro:
+->\protect \foo  .
+l. ...\show\foo
+> \foo =macro:
+->\@protected at testopt \foo  \\foo  {\zz }.
+<recently read> \foo  
+l. ...\expandafter\show\csname foo \endcsname
+> \\foo =macro:
+[#1]->bar.
+<recently read> \\foo  
+l. ......ter\show\csname\string\foo\space\endcsname
+----------------------------------------
+> \cmda=robust macro:
+->\@protected at testopt \cmda \\cmda {\zz }.
+> \\cmda=\long macro:
+> default #1=\zz .
+[#1]->boo.
+<recently read> }
+l. ...\test\cmda{\renewcommand\cmda[1][\zz]{boo}}
+> \cmdb=robust macro:
+->\protect \cmdb  .
+> \cmdb =\long macro:
+#1->boo.
+<argument> \cmdb  
+l. ......t\cmdb{\DeclareRobustCommand\cmdb[1]{boo}}
+> \cmdc=robust macro:
+->\protect \cmdc  .
+> \cmdc =robust macro:
+->\@protected at testopt \cmdc  \\cmdc  {\zz }.
+> \\cmdc =\long macro:
+> default #1=\zz .
+[#1]->boo.
+<recently read> }
+l. ......c{\DeclareRobustCommand\cmdc[1][\zz]{boo}}
+> \cmdd=\protected macro:
+->\@testopt \\cmdd {}.
+<argument> \cmdd 
+l. ......def\csname\string\cmdd\endcsname[#1]{boo}}
+> \!=robust macro:
+->\@protected at testopt \!\\! {\zz }.
+> \\!=\long macro:
+> default #1=\zz .
+[#1]->boo.
+<recently read> }
+l. ...\test\!{\renewcommand\![1][\zz]{boo}}
+LaTeX Info: Redefining \# on input line ....
+> \#=robust macro:
+->\x at protect \#\protect \#  .
+> \# =\long macro:
+#1->boo.
+<argument> \#  
+l. ...\test\#{\DeclareRobustCommand\#[1]{boo}}
+LaTeX Info: Redefining \$ on input line ....
+> \$=robust macro:
+->\x at protect \$\protect \$  .
+> \$ =robust macro:
+->\@protected at testopt \$  \\$  {\zz }.
+> \\$ =\long macro:
+> default #1=\zz .
+[#1]->boo.
+<recently read> }
+l. ...\test\${\DeclareRobustCommand\$[1][\zz]{boo}}
+> \%=\protected macro:
+->\@testopt \\% {}.
+<argument> \%
+l. ......r\def\csname\string\%\endcsname[#1]{boo}}
+\cmda=\count...
+> \cmda=\count187.
+<argument> \cmda 
+l. ... \test\cmda{\newcount\cmda}
+                                 %
+> \cmdb=undefined.
+<argument> \cmdb 
+l. ...\test\cmdb{\let\cmdb\undefined}
+> \cmdc=\relax.
+<argument> \cmdc 
+l. ...\test\cmdc{\let\cmdc\relax}
+> \cmdd=\detokenize.
+<argument> \cmdd 
+l. ...\test\cmdd{\let\cmdd\detokenize}
+> \cmde=macro:
+#1#2#3#4#5#6#7#8#9->.
+<argument> \cmde 
+l. ...\test\cmde{\def\cmde#1#2#3#4#5#6#7#8#9{}}
+> cmda=robust macro:
+->@protected at testopt cmda \cmda {zz }.
+> \cmda=long macro:
+> default #1=zz .
+[#1]->boo.
+<recently read> }
+l. ...\ShowCommand\cmda
+(github-0373.aux)





More information about the latex3-commits mailing list.