Skip to content

Commit

Permalink
Adapt xparse tests to ltcmd
Browse files Browse the repository at this point in the history
- Internals now show __cmd instead of __xparse
- Tests that use deprecated argument types are disabled
  • Loading branch information
PhelypeOleinik committed Jan 20, 2021
1 parent 1b4d35c commit b058a45
Show file tree
Hide file tree
Showing 15 changed files with 404 additions and 695 deletions.
2 changes: 1 addition & 1 deletion base/testfiles-ltcmd/ltcmd000.lvt
Expand Up @@ -11,5 +11,5 @@

\START
\AUTHOR{Bruno Le Floch}
\RequirePackage{xparse}
% \RequirePackage{xparse}
\END
3 changes: 0 additions & 3 deletions base/testfiles-ltcmd/ltcmd000.tlg
@@ -1,6 +1,3 @@
This is a generated file for the LaTeX2e validation system.
Don't change this file in any respect.
Author: Bruno Le Floch
(xparse.sty
Package: xparse ....-..-.. L3 Experimental document command parser
(xparse-generic.tex))
99 changes: 52 additions & 47 deletions base/testfiles-ltcmd/ltcmd001.lvt
Expand Up @@ -9,7 +9,7 @@
\ExplSyntaxOn
\debug_on:n { check-declarations , deprecation , log-functions }
\ExplSyntaxOff
\RequirePackage{xparse}
% \RequirePackage{xparse}

\begin{document}
\START
Expand Down Expand Up @@ -128,41 +128,43 @@
\xparse_show:N \foo
}

\TEST{Arguments~read~up~to~first~brace}{
\OMIT
\DeclareDocumentCommand \foo { l m } {
\tl_set:Nn \l_test_tl { (#1) (#2) }
\tl_show:N \l_test_tl
}
\TIMO
\foo \bar {1}
\foo 100 {2}
\OMIT
\DeclareDocumentCommand \foo { +l m } {
\tl_set:Nn \l_test_tl { (#1) (#2) }
\tl_show:N \l_test_tl
}
\TIMO
\foo \bar

{1}
\foo 100

{2}
}

\TEST{Various~mandatory~combinations}{
\DeclareDocumentCommand \foo { l m } { (#1) (#2) }
\xparse_show:N \foo
\DeclareDocumentCommand \foo { m l m } { (#1) (#2) (#3) }
\xparse_show:N \foo
\DeclareDocumentCommand \foo { u{end} u{stop!} } { (#1) (#2) }
\xparse_show:N \foo
\DeclareDocumentCommand \foo { l l l } { (#1) (#2) (#3) }
\xparse_show:N \foo
\DeclareDocumentCommand \foo { +l >{\foo}u{end} } { (#1) (#2) }
\xparse_show:N \foo
}
% Disabled: test requires deprecated xparse.sty
% \TEST{Arguments~read~up~to~first~brace}{
% \OMIT
% \DeclareDocumentCommand \foo { l m } {
% \tl_set:Nn \l_test_tl { (#1) (#2) }
% \tl_show:N \l_test_tl
% }
% \TIMO
% \foo \bar {1}
% \foo 100 {2}
% \OMIT
% \DeclareDocumentCommand \foo { +l m } {
% \tl_set:Nn \l_test_tl { (#1) (#2) }
% \tl_show:N \l_test_tl
% }
% \TIMO
% \foo \bar
%
% {1}
% \foo 100
%
% {2}
% }

% Disabled: test requires deprecated xparse.sty
% \TEST{Various~mandatory~combinations}{
% \DeclareDocumentCommand \foo { l m } { (#1) (#2) }
% \xparse_show:N \foo
% \DeclareDocumentCommand \foo { m l m } { (#1) (#2) (#3) }
% \xparse_show:N \foo
% \DeclareDocumentCommand \foo { u{end} u{stop!} } { (#1) (#2) }
% \xparse_show:N \foo
% \DeclareDocumentCommand \foo { l l l } { (#1) (#2) (#3) }
% \xparse_show:N \foo
% \DeclareDocumentCommand \foo { +l >{\foo}u{end} } { (#1) (#2) }
% \xparse_show:N \foo
% }

\TEST{Optional~argument~creation}{
\DeclareDocumentCommand \foo { s o m } { (#1) (#2) (#3) }
Expand All @@ -174,10 +176,11 @@
\xparse_show:N \foo
\DeclareDocumentCommand \foo { m o m o } { (#1) (#2) (#3) (#4) }
\xparse_show:N \foo
\DeclareDocumentCommand \foo { m g o m } { (#1) (#2) (#3) (#4) }
\xparse_show:N \foo
\DeclareDocumentCommand \foo { m G{test} s m } { (#1) (#2) (#3) (#4) }
\xparse_show:N \foo
% Disabled: test requires deprecated xparse.sty
% \DeclareDocumentCommand \foo { m g o m } { (#1) (#2) (#3) (#4) }
% \xparse_show:N \foo
% \DeclareDocumentCommand \foo { m G{test} s m } { (#1) (#2) (#3) (#4) }
% \xparse_show:N \foo
}

\TEST{Unknown~argument~types}{
Expand Down Expand Up @@ -245,9 +248,10 @@
\DeclareDocumentEnvironment { foo } { s o +m }
{ (#1) (#2) (#3) } { (#1) (#2) (#3) }
\xparse_show_env:n { foo }
\DeclareDocumentEnvironment { foo } { u{stop} o m }
{ (#1) (#2) (#3) } { (#1) (#2) (#3) }
\xparse_show_env:n { foo }
% Disabled: test requires deprecated xparse.sty
% \DeclareDocumentEnvironment { foo } { u{stop} o m }
% { (#1) (#2) (#3) } { (#1) (#2) (#3) }
% \xparse_show_env:n { foo }
\DeclareDocumentEnvironment { foo } { m o o }
{ (#1) (#2) (#3) } { (#1) (#2) (#3) }
\xparse_show_env:n { foo }
Expand Down Expand Up @@ -360,10 +364,11 @@
{
\DeclareDocumentCommand { \foo } { m m } { #1-#2 }
\TYPE { \exp_not:c { test- \foo { abc } { def } } }
\DeclareDocumentCommand { \foo } { u. } { test-#1 }
\TYPE { \exp_not:c { test- \foo abc . } }
\DeclareDocumentCommand { \foo } { l } { #1 . }
\TYPE { \exp_not:c { test- \foo abc { def } } }
% Disabled: test requires deprecated xparse.sty
% \DeclareDocumentCommand { \foo } { u. } { test-#1 }
% \TYPE { \exp_not:c { test- \foo abc . } }
% \DeclareDocumentCommand { \foo } { l } { #1 . }
% \TYPE { \exp_not:c { test- \foo abc { def } } }
\DeclareDocumentCommand { \foo } { D... } { test-#1 }
\TYPE { \exp_not:c { test- \foo .... } }
\cs_set:cpn { conditionally@traceoff } { \relax } % some int assignment
Expand Down

0 comments on commit b058a45

Please sign in to comment.