[latex3-commits] [git/LaTeX3-latex3-latex3] filename-sanitize: Add tests for invalid tokens in file names (e65fd9d9f)
PhelypeOleinik
phelype.oleinik at latex-project.org
Sat Apr 17 23:21:13 CEST 2021
Repository : https://github.com/latex3/latex3
On branch : filename-sanitize
Link : https://github.com/latex3/latex3/commit/e65fd9d9f100dd5b3ec8a4dc0b7ad35e977f5978
>---------------------------------------------------------------
commit e65fd9d9f100dd5b3ec8a4dc0b7ad35e977f5978
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date: Sat Apr 17 18:21:13 2021 -0300
Add tests for invalid tokens in file names
>---------------------------------------------------------------
e65fd9d9f100dd5b3ec8a4dc0b7ad35e977f5978
l3kernel/testfiles/m3file001.lvt | 14 ++++++
l3kernel/testfiles/m3file001.tlg | 105 ++++++++++++++++++++++++++++++++++++++-
2 files changed, 118 insertions(+), 1 deletion(-)
diff --git a/l3kernel/testfiles/m3file001.lvt b/l3kernel/testfiles/m3file001.lvt
index aaf07b445..9a16d38a1 100644
--- a/l3kernel/testfiles/m3file001.lvt
+++ b/l3kernel/testfiles/m3file001.lvt
@@ -207,6 +207,20 @@
\tl_set:Nx \l_tmpa_tl { \__kernel_file_name_sanitize:n { "foo~.bar" } } \tl_show:N \l_tmpa_tl
}
+\TEST { File~name~with~invalid~tokens }
+ {
+ \tl_set:Nx \l_tmpa_tl { \__kernel_file_name_sanitize:n { foo \relax bar } } \tl_show:N \l_tmpa_tl
+ \tl_set:Nx \l_tmpa_tl { \__kernel_file_name_sanitize:n { foo \csname baz } } \tl_show:N \l_tmpa_tl
+ \tl_set:Nx \l_tmpa_tl { \__kernel_file_name_sanitize:n { foo \csname bar } } \tl_show:N \l_tmpa_tl
+ \def\bar{bar}
+ \tl_set:Nx \l_tmpa_tl { \__kernel_file_name_sanitize:n { foo \csname bar } } \tl_show:N \l_tmpa_tl
+ \def\bar{\csname baz}
+ \def\baz{baz}
+ \tl_set:Nx \l_tmpa_tl { \__kernel_file_name_sanitize:n { foo \csname bar } } \tl_show:N \l_tmpa_tl
+ % Not really good error here:
+ \tl_set:Nx \l_tmpa_tl { \__kernel_file_name_sanitize:n { foo \endcsname bar } } \tl_show:N \l_tmpa_tl
+ }
+
\TEST { Getting~file~information }
{
\file_get_mdfive_hash:nN { filetest-utf8.txt } \l_tmpa_tl
diff --git a/l3kernel/testfiles/m3file001.tlg b/l3kernel/testfiles/m3file001.tlg
index b90b3286b..9d0c0da9a 100644
--- a/l3kernel/testfiles/m3file001.tlg
+++ b/l3kernel/testfiles/m3file001.tlg
@@ -227,7 +227,110 @@ l. ... }
l. ... }
============================================================
============================================================
-TEST 12: Getting file information
+TEST 12: File name with invalid tokens
+============================================================
+! Missing \endcsname inserted.
+<to be read again>
+ \relax
+l. ... }
+The control sequence marked <to be read again> should
+not appear between \csname and \endcsname.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ \relax invalid in file name. Lost: bar.
+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.
+> \l_tmpa_tl=foo.
+<recently read> }
+l. ... }
+! Missing \endcsname inserted.
+<to be read again>
+ \baz
+l. ... }
+The control sequence marked <to be read again> should
+not appear between \csname and \endcsname.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ \baz invalid in file name. Lost: .
+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.
+> \l_tmpa_tl=foo.
+<recently read> }
+l. ... }
+! Missing \endcsname inserted.
+<to be read again>
+ \protect
+l. ... }
+The control sequence marked <to be read again> should
+not appear between \csname and \endcsname.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ \protect invalid in file name. Lost: \bar .
+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.
+> \l_tmpa_tl=foo.
+<recently read> }
+l. ... }
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Missing \endcsname inserted in filename.
+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.
+> \l_tmpa_tl=foobar.
+<recently read> }
+l. ... }
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Missing \endcsname inserted in filename.
+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:
+ Missing \endcsname inserted in filename.
+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.
+> \l_tmpa_tl=foobaz.
+<recently read> }
+l. ... }
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ b invalid in file name. Lost: ar.
+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.
+> \l_tmpa_tl=foo.
+<recently read> }
+l. ... }
+============================================================
+============================================================
+TEST 13: Getting file information
============================================================
TRUE
TRUE
More information about the latex3-commits
mailing list.