[latex3-commits] [git/LaTeX3-latex3-latex3] master: Check a few corner cases of '!' and '+' prefixes in xparse signatures (5fa5626)

Bruno Le Floch bruno at le-floch.fr
Mon Oct 1 14:36:27 CEST 2018


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/5fa56266926fd14483c759a32d9999f5cc722a2a

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

commit 5fa56266926fd14483c759a32d9999f5cc722a2a
Author: Bruno Le Floch <bruno at le-floch.fr>
Date:   Mon Oct 1 14:36:27 2018 +0200

    Check a few corner cases of '!' and '+' prefixes in xparse signatures


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

5fa56266926fd14483c759a32d9999f5cc722a2a
 l3packages/xparse/testfiles/xparse005.lvt |   15 ++++++
 l3packages/xparse/testfiles/xparse005.tlg |   83 +++++++++++++++++++++++++++++
 2 files changed, 98 insertions(+)

diff --git a/l3packages/xparse/testfiles/xparse005.lvt b/l3packages/xparse/testfiles/xparse005.lvt
index 91f2959..d51e9b8 100644
--- a/l3packages/xparse/testfiles/xparse005.lvt
+++ b/l3packages/xparse/testfiles/xparse005.lvt
@@ -27,8 +27,13 @@
     \NewDocumentCommand { \testA } { ! + ! } { }
     \NewDocumentCommand { \testA } { + ! } { }
     \NewDocumentCommand { \testA } { ! } { }
+    \NewDocumentCommand { \testA } { + + m } { }
+    \NewExpandableDocumentCommand { \testA } { ! o } { }
+    \NewExpandableDocumentCommand { \testA } { ! m o } { }
   }
 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 \OMIT
 \cs_new_protected:Npn \test:nw #1 #2 \q_stop
   { \TYPE { \tl_to_str:n { | #1 | #2 | } } }
@@ -53,4 +58,14 @@
   }
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\TEST { Signature~normalized~or~not }
+  {
+    \NewDocumentCommand { \testC } { ! + o } { }
+    \ShowDocumentCommandArgSpec \testC
+    \NewDocumentCommand { \testD } { + ! o } { }
+    \ShowDocumentCommandArgSpec \testD
+  }
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \END
diff --git a/l3packages/xparse/testfiles/xparse005.tlg b/l3packages/xparse/testfiles/xparse005.tlg
index f2ff29f..b0f5a95 100644
--- a/l3packages/xparse/testfiles/xparse005.tlg
+++ b/l3packages/xparse/testfiles/xparse005.tlg
@@ -155,6 +155,69 @@ l. ...  }
 | 
 | LaTeX will ignore this entire definition.
 |...............................................
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \testA with sig. '++m' on line ....
+.................................................
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+! LaTeX error: "xparse/two-markers"
+! 
+! Two '+' apply to the same argument in argument specification of command
+! '\testA'.
+! 
+! See the LaTeX3 documentation for further information.
+! 
+! For immediate help type H <return>.
+!...............................................  
+l. ...  }
+|'''''''''''''''''''''''''''''''''''''''''''''''
+| The argument specification provided has two markers '+' applying to the same
+| argument; these are redundant.
+|...............................................
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \testA with sig. '!o' on line ....
+.................................................
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+! LaTeX error: "xparse/expandable-ending-optional"
+! 
+! Argument specification '!o' for expandable command '\testA' ends with
+! optional argument.
+! 
+! See the LaTeX3 documentation for further information.
+! 
+! For immediate help type H <return>.
+!...............................................  
+l. ...  }
+|'''''''''''''''''''''''''''''''''''''''''''''''
+| Expandable commands must have a final mandatory argument (or no arguments at
+| all). You cannot have a terminal optional argument with expandable commands.
+|...............................................
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \testA with sig. '!mo' on line ....
+.................................................
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+! LaTeX error: "xparse/non-trailing-obey-spaces"
+! 
+! Prefix '!' used before mandatory argument 'm' of command '\testA'.
+! 
+! See the LaTeX3 documentation for further information.
+! 
+! For immediate help type H <return>.
+!...............................................  
+l. ...  }
+|'''''''''''''''''''''''''''''''''''''''''''''''
+| The prefix '!' can only apply to trailing optional arguments.
+| 
+| LaTeX will ignore this entire definition.
+|...............................................
 ============================================================
 ============================================================
 TEST 2: Valid '!' and avoid dropping spaces
@@ -194,3 +257,23 @@ My plan is to forget the whole thing and hope for the best.
 |a|\BooleanTrue |\BooleanTrue ||
 |a|\BooleanTrue |\BooleanTrue | \c_space_token |
 ============================================================
+============================================================
+TEST 3: Signature normalized or not
+============================================================
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \testC with sig. '!+o' on line ....
+.................................................
+> \ArgumentSpecification=!+o.
+<recently read> }
+l. ...  }
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \testD with sig. '+!o' on line ....
+.................................................
+> \ArgumentSpecification=+!o.
+<recently read> }
+l. ...  }
+============================================================





More information about the latex3-commits mailing list