[latex3-commits] [git/LaTeX3-latex3-latex3] master: Use str not cs test for expansion exclusion (d8588c331)

Joseph Wright joseph.wright at morningstar2.co.uk
Tue Sep 1 10:57:17 CEST 2020


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

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

commit d8588c33138beb406830ab4863ae42cd75d608a0
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Tue Sep 1 09:57:17 2020 +0100

    Use str not cs test for expansion exclusion
    
    See https://tex.stackexchange.com/q/560603:
    an \ifx -type test fails if some other token has the
    same meaning as one we are looking for.


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

d8588c33138beb406830ab4863ae42cd75d608a0
 l3kernel/l3text.dtx              |  2 +-
 l3kernel/testfiles/m3text001.lvt | 13 +++++++++++++
 l3kernel/testfiles/m3text001.tlg | 14 ++++++++++++++
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/l3kernel/l3text.dtx b/l3kernel/l3text.dtx
index b1246336d..a679a2caf 100644
--- a/l3kernel/l3text.dtx
+++ b/l3kernel/l3text.dtx
@@ -875,7 +875,7 @@
   {
     \@@_if_recursion_tail_stop_do:Nn #2
       { \@@_expand_letterlike:N #1 }
-    \cs_if_eq:NNTF #2 #1
+    \str_if_eq:nnTF {#1} {#2}
       {
         \@@_use_i_delimit_by_q_recursion_stop:nw
           { \@@_expand_exclude:Nn #1 }
diff --git a/l3kernel/testfiles/m3text001.lvt b/l3kernel/testfiles/m3text001.lvt
index 6d598a830..2290375e8 100644
--- a/l3kernel/testfiles/m3text001.lvt
+++ b/l3kernel/testfiles/m3text001.lvt
@@ -69,4 +69,17 @@
     \text_expand:n { " \AAA " \BBB " \CCC " \SPACEA " \SPACEB " \SPACEC " }
   }
 
+\TEST { Expansion~exclusions }
+  {
+    \cs_generate_variant:Nn \tl_show:n { x }
+    \tl_show:x
+      { \text_expand:n { \tl_map_tokens:nn { { abc} {def } } { tokens } } }
+    \tl_put_right:Nn \l_text_expand_exclude_tl { \NoCaseChange }
+    \cs_set_eq:NN \NoCaseChange \use:n
+    \tl_show:x
+      { \text_expand:n { \tl_map_tokens:nn { { abc } {  def} } { tokens } } }
+    \tl_show:x
+      { \text_expand:n { \tl_map_tokens:nn { { \NoCaseChange { c } } } { tokens } } }
+  }
+
 \END
diff --git a/l3kernel/testfiles/m3text001.tlg b/l3kernel/testfiles/m3text001.tlg
index 199f30f57..68ac3286f 100644
--- a/l3kernel/testfiles/m3text001.tlg
+++ b/l3kernel/testfiles/m3text001.tlg
@@ -37,3 +37,17 @@ TEST 6: Implicit tokens
 ============================================================
 "\AAA "\BBB "\CCC " " " "
 ============================================================
+============================================================
+TEST 7: Expansion exclusions
+============================================================
+Defining \tl_show:x on line ...
+> tokens{abc}tokens{def}.
+<recently read> }
+l. ...  }
+> tokens{abc}tokens{def}.
+<recently read> }
+l. ...  }
+> tokens{\NoCaseChange {c}}.
+<recently read> }
+l. ...  }
+============================================================





More information about the latex3-commits mailing list.