[latex3-commits] [git/LaTeX3-latex3-latex3] cs-delimited-args: Add tests for forbidden delimiters (211a7312e)

PhelypeOleinik tex.phelype at gmail.com
Fri Feb 28 16:48:30 CET 2020


Repository : https://github.com/latex3/latex3
On branch  : cs-delimited-args
Link       : https://github.com/latex3/latex3/commit/211a7312ec7727a38da3217dab3f2a809be85950

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

commit 211a7312ec7727a38da3217dab3f2a809be85950
Author: PhelypeOleinik <tex.phelype at gmail.com>
Date:   Fri Feb 28 12:48:30 2020 -0300

    Add tests for forbidden delimiters


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

211a7312ec7727a38da3217dab3f2a809be85950
 l3packages/xparse/testfiles/xparse004.luatex.tlg | 63 ++++++++++++++++++++++--
 l3packages/xparse/testfiles/xparse004.lvt        | 23 +++++++++
 l3packages/xparse/testfiles/xparse004.tlg        | 63 ++++++++++++++++++++++--
 3 files changed, 143 insertions(+), 6 deletions(-)

diff --git a/l3packages/xparse/testfiles/xparse004.luatex.tlg b/l3packages/xparse/testfiles/xparse004.luatex.tlg
index b6cd87439..22b418211 100644
--- a/l3packages/xparse/testfiles/xparse004.luatex.tlg
+++ b/l3packages/xparse/testfiles/xparse004.luatex.tlg
@@ -869,7 +869,64 @@ Removed: (\)abc\))
 Removed: (abc\){})
 ============================================================
 ============================================================
-TEST 30: IfBoolean multi token
+TEST 30: Non-character delimiters: forbidden delimiters
+============================================================
+! LaTeX3 Error: Argument delimiter '\(' for the command '\foo' is not allowed.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+The argument specification provided was not valid: the implicit begin-group
+token '\(' is not allowed as an argument delimiter.
+LaTeX will ignore this entire definition.
+! LaTeX3 Error: Argument delimiter '\(' for the command '\foo' is not allowed.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+The argument specification provided was not valid: the implicit begin-group
+token '\(' is not allowed as an argument delimiter.
+LaTeX will ignore this entire definition.
+! LaTeX3 Error: Argument delimiter '\)' for the command '\foo' is not allowed.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+The argument specification provided was not valid: the implicit end-group
+token '\)' is not allowed as an argument delimiter.
+LaTeX will ignore this entire definition.
+! LaTeX3 Error: Argument delimiter '\)' for the command '\foo' is not allowed.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+The argument specification provided was not valid: the implicit end-group
+token '\)' is not allowed as an argument delimiter.
+LaTeX will ignore this entire definition.
+! LaTeX3 Error: Argument delimiter '\(' for the command '\foo' is not allowed.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+The argument specification provided was not valid: the implicit begin-group
+token '\(' is not allowed as an argument delimiter.
+LaTeX will ignore this entire definition.
+! LaTeX3 Error: Argument delimiter '\)' for the command '\foo' is not allowed.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+The argument specification provided was not valid: the implicit end-group
+token '\)' is not allowed as an argument delimiter.
+LaTeX will ignore this entire definition.
+! LaTeX3 Error: Argument delimiter '\(' for the command '\foo' is not allowed.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+The argument specification provided was not valid: the implicit begin-group
+token '\(' is not allowed as an argument delimiter.
+LaTeX will ignore this entire definition.
+(abc)
+(abc)
+(abc)
+(abc)
+============================================================
+============================================================
+TEST 31: IfBoolean multi token
 ============================================================
 ! Undefined control sequence.
 <argument> \LaTeX3 error: 
@@ -902,13 +959,13 @@ and I'll forget about whatever was undefined.
 FALSE
 ============================================================
 ============================================================
-TEST 31: Processor spaces
+TEST 32: Processor spaces
 ============================================================
 |{a}{bcd}|
 > \box_wd:N \l_tmpa_box =0.0pt.
 ============================================================
 ============================================================
-TEST 32: Processor depending on other argument
+TEST 33: Processor depending on other argument
 ============================================================
 |{a}{bcd;e}|1|
 |{a,bcd}{e}|1|
diff --git a/l3packages/xparse/testfiles/xparse004.lvt b/l3packages/xparse/testfiles/xparse004.lvt
index 13158296f..05406af0b 100644
--- a/l3packages/xparse/testfiles/xparse004.lvt
+++ b/l3packages/xparse/testfiles/xparse004.lvt
@@ -481,6 +481,29 @@
     \foo\)abc\){}\z
   }
 
+\TEST { Non-character~delimiters:~forbidden~delimiters }
+  {
+    \cs_set_eq:NN \( \c_group_begin_token
+    \cs_set_eq:NN \) \c_group_end_token
+    \cs_set:Npn \clean #1 \z
+      { \tl_if_empty:nF {#1} { \TYPE { Removed:~( \exp_not:n {#1} ) } } }
+    % Invalid defitions:
+    \DeclareDocumentCommand { \foo } { d\(\) } { }
+    \DeclareExpandableDocumentCommand { \foo } { d\(\) m } { }
+    \DeclareDocumentCommand { \foo } { d\)\( } { }
+    \DeclareExpandableDocumentCommand { \foo } { d\)\( m } { }
+    \DeclareDocumentCommand { \foo } { t\( } { }
+    \DeclareDocumentCommand { \foo } { t\) } { }
+    \DeclareDocumentCommand { \foo } { e{\(\)} } { }
+    % Valid defitions:
+    \DeclareDocumentCommand { \foo } { d? \) } { \TYPE { (#1) } }
+    \foo? abc\)
+    \foo? abc\)
+    \DeclareExpandableDocumentCommand { \foo } { d? \) m } { \TYPE { (#1) } \clean }
+    \foo? abc\){}\z
+    \foo? abc\){}\z
+  }
+
 \TEST { IfBoolean~multi~token }
   {
     \IfBooleanT { } { \ERROR }
diff --git a/l3packages/xparse/testfiles/xparse004.tlg b/l3packages/xparse/testfiles/xparse004.tlg
index 659497734..69529e2b4 100644
--- a/l3packages/xparse/testfiles/xparse004.tlg
+++ b/l3packages/xparse/testfiles/xparse004.tlg
@@ -869,7 +869,64 @@ Removed: (\)abc\))
 Removed: (abc\){})
 ============================================================
 ============================================================
-TEST 30: IfBoolean multi token
+TEST 30: Non-character delimiters: forbidden delimiters
+============================================================
+! LaTeX3 Error: Argument delimiter '\(' for the command '\foo' is not allowed.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+The argument specification provided was not valid: the implicit begin-group
+token '\(' is not allowed as an argument delimiter.
+LaTeX will ignore this entire definition.
+! LaTeX3 Error: Argument delimiter '\(' for the command '\foo' is not allowed.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+The argument specification provided was not valid: the implicit begin-group
+token '\(' is not allowed as an argument delimiter.
+LaTeX will ignore this entire definition.
+! LaTeX3 Error: Argument delimiter '\)' for the command '\foo' is not allowed.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+The argument specification provided was not valid: the implicit end-group
+token '\)' is not allowed as an argument delimiter.
+LaTeX will ignore this entire definition.
+! LaTeX3 Error: Argument delimiter '\)' for the command '\foo' is not allowed.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+The argument specification provided was not valid: the implicit end-group
+token '\)' is not allowed as an argument delimiter.
+LaTeX will ignore this entire definition.
+! LaTeX3 Error: Argument delimiter '\(' for the command '\foo' is not allowed.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+The argument specification provided was not valid: the implicit begin-group
+token '\(' is not allowed as an argument delimiter.
+LaTeX will ignore this entire definition.
+! LaTeX3 Error: Argument delimiter '\)' for the command '\foo' is not allowed.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+The argument specification provided was not valid: the implicit end-group
+token '\)' is not allowed as an argument delimiter.
+LaTeX will ignore this entire definition.
+! LaTeX3 Error: Argument delimiter '\(' for the command '\foo' is not allowed.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+The argument specification provided was not valid: the implicit begin-group
+token '\(' is not allowed as an argument delimiter.
+LaTeX will ignore this entire definition.
+(abc)
+(abc)
+(abc)
+(abc)
+============================================================
+============================================================
+TEST 31: IfBoolean multi token
 ============================================================
 ! Undefined control sequence.
 <argument> \LaTeX3 error: 
@@ -902,13 +959,13 @@ and I'll forget about whatever was undefined.
 FALSE
 ============================================================
 ============================================================
-TEST 31: Processor spaces
+TEST 32: Processor spaces
 ============================================================
 |{a}{bcd}|
 > \box_wd:N \l_tmpa_box =0.0pt.
 ============================================================
 ============================================================
-TEST 32: Processor depending on other argument
+TEST 33: Processor depending on other argument
 ============================================================
 |{a}{bcd;e}|1|
 |{a,bcd}{e}|1|





More information about the latex3-commits mailing list.