[latex3-commits] [git/LaTeX3-latex3-latex3] master: add more tests for keyval_parse:nnn (66a942bf1)
Joseph Wright
joseph.wright at morningstar2.co.uk
Thu Dec 31 12:05:47 CET 2020
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/66a942bf1815a817ba5a454cf6b5e0eb8276a274
>---------------------------------------------------------------
commit 66a942bf1815a817ba5a454cf6b5e0eb8276a274
Author: Jonathan Spratte <jspratte at yahoo.de>
Date: Sun Dec 20 14:19:29 2020 +0100
add more tests for keyval_parse:nnn
to make sure the tokens are forwarded correctly even in the error case
I've added more tests, so that each error is triggered once before the
parsing is done.
>---------------------------------------------------------------
66a942bf1815a817ba5a454cf6b5e0eb8276a274
...keyval002.luatex.tlg => m3keyval003.luatex.tlg} | 57 ++++-----------------
l3kernel/testfiles/m3keyval003.lvt | 20 ++++++++
l3kernel/testfiles/m3keyval003.tlg | 59 ++++++++++++++++++++++
3 files changed, 88 insertions(+), 48 deletions(-)
diff --git a/l3kernel/testfiles/m3keyval002.luatex.tlg b/l3kernel/testfiles/m3keyval003.luatex.tlg
similarity index 62%
copy from l3kernel/testfiles/m3keyval002.luatex.tlg
copy to l3kernel/testfiles/m3keyval003.luatex.tlg
index d4c278a41..673c2d624 100644
--- a/l3kernel/testfiles/m3keyval002.luatex.tlg
+++ b/l3kernel/testfiles/m3keyval003.luatex.tlg
@@ -2,53 +2,17 @@ This is a generated file for the LaTeX (2e + expl3) validation system.
Don't change this file in any respect.
Author: Jonathan P. Spratte
============================================================
-TEST 1: mixed categories expandably
+TEST 1: pass in several tokens
============================================================
+\KV_check_key_val:nnnn {key}{val}{k}{v}\KV_check_key:nn {key}{k}\KV_check_key_val:nnnn {key}{val}{key}{val}\KV_check_key:nn {key}{key}
+000.111.
============================================================
-\KV_key_no_value_elt:n {a1}\KV_key_no_value_elt:n {a2}\KV_key_value_elt:nn {a3}{b1}\KV_key_value_elt:nn {a4}{b2}
============================================================
-Key: a1
-NoValue
-Key: a2
-NoValue
-Key: a3
-Value: b1
-Key: a4
-Value: b2
+TEST 2: errors with several tokens
============================================================
-============================================================
-TEST 2: blank key errors
-============================================================
-! Undefined control sequence.
-<argument> \LaTeX3 error:
- Blank key name in key-value input on line ...
-l. ... }
-The control sequence at the end of the top line
-of your error message was never \def'ed. If you have
-misspelled it (e.g., `\hobx'), type `I' and the correct
-spelling (e.g., `I\hbox'). Otherwise just continue,
-and I'll forget about whatever was undefined.
-! Undefined control sequence.
-<argument> \LaTeX3 error:
- Blank key name in key-value input on line ...
-l. ... }
-The control sequence at the end of the top line
-of your error message was never \def'ed. If you have
-misspelled it (e.g., `\hobx'), type `I' and the correct
-spelling (e.g., `I\hbox'). Otherwise just continue,
-and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Blank key name in key-value input on line ...
-l. ... }
-The control sequence at the end of the top line
-of your error message was never \def'ed. If you have
-misspelled it (e.g., `\hobx'), type `I' and the correct
-spelling (e.g., `I\hbox'). Otherwise just continue,
-and I'll forget about whatever was undefined.
-! Undefined control sequence.
-<argument> \LaTeX3 error:
- Blank key name in key-value input on line ...
+ Misplaced equals sign in key-value input on line ...
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -57,17 +21,13 @@ spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Blank key name in key-value input on line ...
+ Misplaced equals sign in key-value input on line ...
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
-============================================================
-============================================================
-TEST 3: multiple equals errors
-============================================================
! Undefined control sequence.
<argument> \LaTeX3 error:
Misplaced equals sign in key-value input on line ...
@@ -88,7 +48,7 @@ spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Misplaced equals sign in key-value input on line ...
+ Blank key name in key-value input on line ...
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -97,11 +57,12 @@ spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Misplaced equals sign in key-value input on line ...
+ Blank key name in key-value input on line ...
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
+\KV_check_key_val:nnnn {key}{val}{key}{val}\KV_check_key:nn {key}{key}
============================================================
diff --git a/l3kernel/testfiles/m3keyval003.lvt b/l3kernel/testfiles/m3keyval003.lvt
index 590a59989..4b631284f 100644
--- a/l3kernel/testfiles/m3keyval003.lvt
+++ b/l3kernel/testfiles/m3keyval003.lvt
@@ -20,6 +20,17 @@
\str_if_eq:nnTF {#1} {#3} { 1 } { 0 }
\str_if_eq:nnTF {#2} {#4} { 1 } { 0 }
}
+\char_set_catcode_active:N ;
+\char_set_catcode_active:N "
+\char_set_lccode:nn { `\; } { `\, }
+\char_set_lccode:nn { `\" } { `\= }
+\tl_new:N \l_keyval_errors_tl
+\tex_lowercase:D
+ {
+ \group_end:
+ \cs_set_nopar:Npn \l_keyval_errors_tl
+ { a1=b1=c1, a2=b2"c2; a3"b3=c3, a4"b4"c4, = v, {}, }
+ }
\TIMO
\TESTEXP{pass~ in~ several~ tokens}
@@ -38,4 +49,13 @@
}
}
+\TESTEXP{errors~ with~ several~ tokens}
+ {
+ \exp_args:Nnno
+ \keyval_parse:nnn
+ { \KV_check_key:nn { key } }
+ { \KV_check_key_val:nnnn { key } { val } }
+ { \l_keyval_errors_tl, key=val, key }
+ }
+
\END
diff --git a/l3kernel/testfiles/m3keyval003.tlg b/l3kernel/testfiles/m3keyval003.tlg
index 3b6df5e14..6df39d016 100644
--- a/l3kernel/testfiles/m3keyval003.tlg
+++ b/l3kernel/testfiles/m3keyval003.tlg
@@ -7,3 +7,62 @@ TEST 1: pass in several tokens
\KV_check_key_val:nnnn {key}{val}{k}{v}\KV_check_key:nn {key}{k}\KV_check_key_val:nnnn {key}{val}{key}{val}\KV_check_key:nn {key}{key}
000.111.
============================================================
+============================================================
+TEST 2: errors with several tokens
+============================================================
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Misplaced equals sign in key-value input on line ...
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Misplaced equals sign in key-value input on line ...
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Misplaced equals sign in key-value input on line ...
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Misplaced equals sign in key-value input on line ...
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Blank key name in key-value input on line ...
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Blank key name in key-value input on line ...
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+\KV_check_key_val:nnnn {key}{val}{key}{val}\KV_check_key:nn {key}{key}
+============================================================
More information about the latex3-commits
mailing list.