[latex3-commits] [git/LaTeX3-latex3-latex3] master: fix tl_if_single:nTF; add tests (fe98d96d1)

Bruno Le Floch blflatex at gmail.com
Tue Oct 27 09:11:58 CET 2020


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

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

commit fe98d96d1a86e98054bacb4c654f6f3c9875a3c0
Author: Jonathan Spratte <jspratte at yahoo.de>
Date:   Fri Sep 18 14:34:53 2020 +0200

    fix tl_if_single:nTF; add tests


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

fe98d96d1a86e98054bacb4c654f6f3c9875a3c0
 l3kernel/l3tl.dtx              |  8 +++----
 l3kernel/testfiles/m3tl006.lvt | 51 ++++++++++++++++++++++++------------------
 l3kernel/testfiles/m3tl006.tlg |  2 +-
 3 files changed, 34 insertions(+), 27 deletions(-)

diff --git a/l3kernel/l3tl.dtx b/l3kernel/l3tl.dtx
index d55a2da8d..342c3e35d 100644
--- a/l3kernel/l3tl.dtx
+++ b/l3kernel/l3tl.dtx
@@ -2325,11 +2325,11 @@
 % \end{macro}
 %
 % \begin{macro}[EXP,pTF]{\tl_if_single:n}
-% \begin{macro}[EXP,pTF]{\@@_if_single:n}
+% \begin{macro}[EXP]{\@@_if_single:nnw}
 %   This test is similar to \cs{tl_if_empty:nTF}.  Expanding
-%   \cs{use_none:n} |#1| |?| once yields an empty result if |#1| is
+%   \cs{use_none:nn} |#1| |??| once yields an empty result if |#1| is
 %   blank, a single~|?| if |#1| has a single item, and otherwise yields
-%   some tokens ending with |?|.  Then, \cs{__kernel_tl_to_str:w} makes sure
+%   some tokens ending with |??|.  Then, \cs{__kernel_tl_to_str:w} makes sure
 %   there are no odd category codes.  An earlier version would compare
 %   the result to a single~|?| using string comparison, but the Lua call
 %   is slow in \LuaTeX{}.  Instead, \cs{@@_if_single:nnw} picks the
@@ -2346,7 +2346,7 @@
   {
     \if:w \scan_stop: \exp_after:wN \@@_if_single:nnw
         \__kernel_tl_to_str:w
-          \exp_after:wN { \use_none:n #1 ? } \scan_stop: ? \s_@@_stop
+          \exp_after:wN { \use_none:nn #1 ?? } \scan_stop: ? \s_@@_stop
       \prg_return_true:
     \else:
       \prg_return_false:
diff --git a/l3kernel/testfiles/m3tl006.lvt b/l3kernel/testfiles/m3tl006.lvt
index e01bff5ba..7ac80bad5 100644
--- a/l3kernel/testfiles/m3tl006.lvt
+++ b/l3kernel/testfiles/m3tl006.lvt
@@ -16,29 +16,36 @@
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-\TESTEXP{tl_if_single}{
-  \tl_if_single:nTF {}               ?F
-  \tl_if_single:nTF {~}              ?F
-  \exp_args:Nf \tl_if_single:nTF
-    { \prg_replicate:nn {5} {~} }    ?F
-  \tl_if_single:nTF {\foo}           T?
-  \tl_if_single:nTF {^^65}           T?
-  \tl_if_single:nTF {~\foo}          T?
-  \tl_if_single:nTF { * ~ }          T?
-  \tl_if_single:nTF { ~*~ }          T?
-  \tl_if_single:nTF { A B }          ?F
-  \tl_if_single:nTF { { } }          T?
-  \tl_if_single:nTF { { }~}          T?
-  \tl_if_single:nTF {~{ } }          T?
-  \tl_if_single:nTF {~{ }~}          T?
-  \tl_if_single:nTF { {A} }          T?
-  \tl_if_single:nTF { {A}~}          T?
-  \tl_if_single:nTF {~{A} }          T?
-  \tl_if_single:nTF {~{A}~}          T?
-  \tl_if_single:nTF {A{B} }          ?F
-  \tl_if_single:nTF { {B}A}          ?F
-  \tl_if_single:nTF {{} {}}          ?F
+{\escapechar=-1\relax
+  \TESTEXP{tl_if_single}{
+    \tl_if_single:nTF {}               ?F
+    \tl_if_single:nTF {~}              ?F
+    \exp_args:Nf \tl_if_single:nTF
+      { \prg_replicate:nn {5} {~} }    ?F
+    \tl_if_single:nTF {\foo}           T?
+    \tl_if_single:nTF {^^65}           T?
+    \tl_if_single:nTF {~\foo}          T?
+    \tl_if_single:nTF { * ~ }          T?
+    \tl_if_single:nTF { ~*~ }          T?
+    \tl_if_single:nTF { A B }          ?F
+    \tl_if_single:nTF { { } }          T?
+    \tl_if_single:nTF { { }~}          T?
+    \tl_if_single:nTF {~{ } }          T?
+    \tl_if_single:nTF {~{ }~}          T?
+    \tl_if_single:nTF { {A} }          T?
+    \tl_if_single:nTF { {A}~}          T?
+    \tl_if_single:nTF {~{A} }          T?
+    \tl_if_single:nTF {~{A}~}          T?
+    \tl_if_single:nTF {A{B} }          ?F
+    \tl_if_single:nTF { {B}A}          ?F
+    \tl_if_single:nTF {{} {}}          ?F
+    \tl_if_single:nTF { A \ }          ?F
+    \exp_args:Ne \tl_if_single:nTF
+      { A \char_generate:nn { 32 } { 11 } } ?F
+  }
 }
+\OMIT
+\TIMO
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
diff --git a/l3kernel/testfiles/m3tl006.tlg b/l3kernel/testfiles/m3tl006.tlg
index 4c07f2d28..324545c7d 100644
--- a/l3kernel/testfiles/m3tl006.tlg
+++ b/l3kernel/testfiles/m3tl006.tlg
@@ -4,7 +4,7 @@ Author: Bruno Le Floch
 ============================================================
 TEST 1: tl_if_single
 ============================================================
-FFFTTTTTFTTTTTTTTFFF
+FFFTTTTTFTTTTTTTTFFFFF
 ============================================================
 ============================================================
 TEST 2: tl_if_single_token





More information about the latex3-commits mailing list.