[latex3-commits] [git/LaTeX3-latex3-latex3] master: Test the cctab nesting checks: they don't catch all problems cleanly (c31beffc7)
Joseph Wright
joseph.wright at morningstar2.co.uk
Thu Jul 16 12:13:16 CEST 2020
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/c31beffc7efcf01fffc71e196769aa38d075a764
>---------------------------------------------------------------
commit c31beffc7efcf01fffc71e196769aa38d075a764
Author: Bruno Le Floch <bruno at le-floch.fr>
Date: Tue Jul 14 22:45:35 2020 +0200
Test the cctab nesting checks: they don't catch all problems cleanly
The current cctab nesting checks rely on making \cctab_begin:N define
locally some command that is undefined later on locally by \cctab_end:.
In this test file the command remains defined after a first bad nesting
and a later bad nesting is then not caught.
>---------------------------------------------------------------
c31beffc7efcf01fffc71e196769aa38d075a764
l3kernel/testfiles/m3cctab002.lvt | 36 ++++++++++++++++++++++++++++++++++++
l3kernel/testfiles/m3cctab002.tlg | 33 +++++++++++++++++++++++++++++++++
2 files changed, 69 insertions(+)
diff --git a/l3kernel/testfiles/m3cctab002.lvt b/l3kernel/testfiles/m3cctab002.lvt
index 4785ae180..e9030780d 100644
--- a/l3kernel/testfiles/m3cctab002.lvt
+++ b/l3kernel/testfiles/m3cctab002.lvt
@@ -65,6 +65,42 @@
\cctab_gset:Nn \l_const_cctab { }
}
+\TEST { Wrong~nesting~with~groups:~expect~three~errors~and~many~TRUE }
+ {
+ \int_compare:nNnTF { \char_value_catcode:n { `_ } } = { 11 } { \TRUE } { \ERROR }
+ \cctab_begin:N \c_document_cctab
+ \group_begin:
+ \cctab_end:
+ \int_compare:nNnTF { \char_value_catcode:n { `_ } } = { 11 } { \TRUE } { \ERROR }
+ \group_end:
+ \int_compare:nNnTF { \char_value_catcode:n { `_ } } = { 8 } { \TRUE } { \ERROR }
+ \SEPARATOR
+ \group_begin:
+ \cctab_select:N \c_initex_cctab
+ \int_compare:nNnTF { \char_value_catcode:n { `\{ } } = { 12 } { \TRUE } { \ERROR }
+ \cctab_begin:N \c_str_cctab
+ \int_compare:nNnTF { \char_value_catcode:n { `A } } = { 12 } { \TRUE } { \ERROR }
+ \group_end:
+ \int_compare:nNnTF { \char_value_catcode:n { `_ } } = { 8 } { \TRUE } { \ERROR }
+ \cctab_end:
+ \int_compare:nNnTF { \char_value_catcode:n { `\{ } } = { 12 } { \TRUE } { \ERROR }
+ \SEPARATOR
+ \cctab_select:N \c_code_cctab
+ \group_begin:
+ \cctab_select:N \c_str_cctab
+ \int_compare:nNnTF { \char_value_catcode:n { `_ } } = { 12 } { \TRUE } { \ERROR }
+ \cctab_begin:N \c_document_cctab
+ \int_compare:nNnTF { \char_value_catcode:n { `_ } } = { 8 } { \TRUE } { \ERROR }
+ \group_end:
+ \int_compare:nNnTF { \char_value_catcode:n { `_ } } = { 11 } { \TRUE } { \ERROR }
+ \group_begin:
+ \int_compare:nNnTF { \char_value_catcode:n { `_ } } = { 11 } { \TRUE } { \ERROR }
+ \cctab_end:
+ \int_compare:nNnTF { \char_value_catcode:n { `_ } } = { 12 } { \TRUE } { \ERROR }
+ \group_end:
+ \int_compare:nNnTF { \char_value_catcode:n { `_ } } = { 11 } { \TRUE } { \ERROR }
+ }
+
\ExplSyntaxOff
\END
diff --git a/l3kernel/testfiles/m3cctab002.tlg b/l3kernel/testfiles/m3cctab002.tlg
index 1a7c0aaf2..172492d9b 100644
--- a/l3kernel/testfiles/m3cctab002.tlg
+++ b/l3kernel/testfiles/m3cctab002.tlg
@@ -128,3 +128,36 @@ l. ... }
This is a coding error.
Global assignment to a local variable '\l_const_cctab'.
============================================================
+============================================================
+TEST 7: Wrong nesting with groups: expect three errors and many TRUE
+============================================================
+TRUE
+! LaTeX3 Error: \cctab_end: occurred in a higher group level than the matching
+(LaTeX3) \cctab_begin:N.
+For immediate help type H <return>.
+ ...
+l. ... }
+Catcode tables and groups must be properly nested, but you tried to interleave
+them. LaTeX will try to proceed, but results may be unexpected.
+TRUE
+TRUE
+============================================================
+TRUE
+TRUE
+TRUE
+! LaTeX3 Error: \cctab_end: occurred in a lower group level than the matching
+(LaTeX3) \cctab_begin:N.
+For immediate help type H <return>.
+ ...
+l. ... }
+Catcode tables and groups must be properly nested, but you tried to interleave
+them. LaTeX will try to proceed, but results may be unexpected.
+TRUE
+============================================================
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+============================================================
More information about the latex3-commits
mailing list.