[latex3-commits] [git/LaTeX3-latex3-latex3] master: Update tests for \file_get:nnN (d4c32d9)
Joseph Wright
joseph.wright at morningstar2.co.uk
Wed Jan 16 14:44:54 CET 2019
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/d4c32d9b58a7397f30131da03de8670def0b49d7
>---------------------------------------------------------------
commit d4c32d9b58a7397f30131da03de8670def0b49d7
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Wed Jan 16 13:44:54 2019 +0000
Update tests for \file_get:nnN
Somewhat less complex than \tl_set_from_file:Nnn
>---------------------------------------------------------------
d4c32d9b58a7397f30131da03de8670def0b49d7
l3kernel/testfiles/m3file002.lvt | 77 ++++++++++----------------------------
l3kernel/testfiles/m3file002.tlg | 67 ++-------------------------------
2 files changed, 23 insertions(+), 121 deletions(-)
diff --git a/l3kernel/testfiles/m3file002.lvt b/l3kernel/testfiles/m3file002.lvt
index 3f537f0..b483c51 100644
--- a/l3kernel/testfiles/m3file002.lvt
+++ b/l3kernel/testfiles/m3file002.lvt
@@ -16,7 +16,7 @@
\ExplSyntaxOff
\START
-\AUTHOR{Bruno Le Floch}
+\AUTHOR{Bruno Le Floch, Joseph Wright}
\ExplSyntaxOn
\OMIT
@@ -35,70 +35,31 @@
\TIMO
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\TEST { Set~tl~from~a~file }
+\TEST { Get~a~file }
{
- \group_begin:
- \test_wrapping:
- \tl_gset_from_file:Nnn \l_A_tl { } { \filea }
- \tl_set_from_file:Nnn \l_B_tl { \ExplSyntaxOff } { \filea }
- \tl_gset_from_file:Nnn \l_C_tl
- {
- \ExplSyntaxOff
- \int_set:Nn \tex_endlinechar:D { -1 }
- }
- { \filea }
- \TYPE
- {
- | \tl_to_str:N \l_A_tl | \test_newline:
- | \tl_to_str:N \l_B_tl | \test_newline:
- | \tl_to_str:N \l_C_tl | \test_newline:
- }
- \group_end:
- \tl_if_empty:NT \l_A_tl { \ERROR }
- \tl_if_empty:NF \l_B_tl { \ERROR }
- \tl_if_empty:NT \l_C_tl { \ERROR }
+ \test_wrapping:
+ \file_get:nnN { \filea } { } \l_A_tl
+ \file_get:nnN { \filea } { \ExplSyntaxOff } \l_B_tl
+ \file_get:nnN { \filea }
+ {
+ \ExplSyntaxOff
+ \int_set:Nn \tex_endlinechar:D { -1 }
+ }
+ \l_C_tl
+ \TYPE
+ {
+ | \tl_to_str:N \l_A_tl | \test_newline:
+ | \tl_to_str:N \l_B_tl | \test_newline:
+ | \tl_to_str:N \l_C_tl | \test_newline:
+ }
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\OMIT
-\tl_clear:N \l_A_tl
-\tl_clear:N \l_B_tl
-\tl_clear:N \l_C_tl
-\TIMO
-
-\TEST { Set~tl~from~a~file~with~expansion }
- {
- \group_begin:
- \test_wrapping:
- \tl_gset_from_file_x:Nnn \l_A_tl { } { \filea }
- \tl_set_from_file_x:Nnn \l_B_tl { \ExplSyntaxOff } { \filea }
- \tl_gset_from_file_x:Nnn \l_C_tl
- {
- \ExplSyntaxOff
- \int_set:Nn \tex_endlinechar:D { `\\ }
- \cs_set:cpn { } { / \test_newline: }
- }
- { \filea }
- \TYPE
- {
- | \tl_to_str:N \l_A_tl | \test_newline:
- | \tl_to_str:N \l_B_tl | \test_newline:
- | \tl_to_str:N \l_C_tl | \test_newline:
- }
- \group_end:
- \tl_if_empty:NT \l_A_tl { \ERROR }
- \tl_if_empty:NF \l_B_tl { \ERROR }
- \tl_if_empty:NT \l_C_tl { \ERROR }
- }
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\TEST { Set~tl~from~inexistent~file }
+\TEST { Get~a~non-existent~file }
{
\tl_set:Nn \l_A_tl { A }
- \tl_set_from_file:Nnn \l_A_tl { \ERROR } { \fileb }
- \tl_gset_from_file:Nnn \l_A_tl { \ERROR } { \fileb }
- \tl_set_from_file_x:Nnn \l_A_tl { \ERROR } { \fileb }
- \tl_gset_from_file_x:Nnn \l_A_tl { \ERROR } { \fileb }
+ \file_get:nnN { \fileb } { \ERROR } \l_A_tl
\TYPE { | \tl_to_str:N \l_A_tl | }
}
diff --git a/l3kernel/testfiles/m3file002.tlg b/l3kernel/testfiles/m3file002.tlg
index dbfe55e..c62540a 100644
--- a/l3kernel/testfiles/m3file002.tlg
+++ b/l3kernel/testfiles/m3file002.tlg
@@ -1,23 +1,10 @@
This is a generated file for the LaTeX (2e + expl3) validation system.
Don't change this file in any respect.
-Author: Bruno Le Floch
+Author: Bruno Le Floch, Joseph Wright
============================================================
-TEST 1: Set tl from a file
+TEST 1: Get a file
============================================================
-(filetest.txt)
-! LaTeX3 Error: Inconsistent local/global assignment
-For immediate help type H <return>.
- ...
-l. ... }
-This is a coding error.
-Global assignment to a local variable '\l_A_tl'.
-(filetest.txt) (filetest.txt)
-! LaTeX3 Error: Inconsistent local/global assignment
-For immediate help type H <return>.
- ...
-l. ... }
-This is a coding error.
-Global assignment to a local variable '\l_C_tl'.
+(filetest.txt) (filetest.txt) (filetest.txt)
|\ExplSyntaxOff Thisfileisneededbym3file001.lvt
m3ior001.lvtandm3ior002.lvt:Pleaseleaveitalone!\ExplSyntaxOn |
|\ExplSyntaxOff This file is needed by m3file001.lvt
@@ -26,35 +13,7 @@ m3ior001.lvtandm3ior002.lvt:Pleaseleaveitalone!\ExplSyntaxOn |
m3ior001.lvt and m3ior002.lvt:Please leave it alone!\ExplSyntaxOn |
============================================================
============================================================
-TEST 2: Set tl from a file with expansion
-============================================================
-(filetest.txt)
-! LaTeX3 Error: Inconsistent local/global assignment
-For immediate help type H <return>.
- ...
-l. ... }
-This is a coding error.
-Global assignment to a local variable '\l_A_tl'.
-(filetest.txt) (filetest.txt)
-! LaTeX3 Error: Inconsistent local/global assignment
-For immediate help type H <return>.
- ...
-l. ... }
-This is a coding error.
-Global assignment to a local variable '\l_C_tl'.
-|\ExplSyntaxOff Thisfileisneededbym3file001.lvt
-m3ior001.lvtandm3ior002.lvt:Pleaseleaveitalone!\ExplSyntaxOn |
-|\ExplSyntaxOff This file is needed by m3file001.lvt
- m3ior001.lvt and m3ior002.lvt: Please leave it alone! \ExplSyntaxOn |
-|\ExplSyntaxOff /
-This file is needed by m3file001.lvt
- m3ior001.lvt and m3ior002.lvt:/
-Please leave it alone!/
-\ExplSyntaxOn /
-|
-============================================================
-============================================================
-TEST 3: Set tl from inexistent file
+TEST 2: Get a non-existent file
============================================================
! LaTeX3 Error: File 'NotAFile.xxx.yyy.zzz' not found.
For immediate help type H <return>.
@@ -62,23 +21,5 @@ For immediate help type H <return>.
l. ... }
The requested file could not be found in the current directory, in the TeX
search path or in the LaTeX search path.
-! LaTeX3 Error: File 'NotAFile.xxx.yyy.zzz' not found.
-For immediate help type H <return>.
- ...
-l. ... }
-The requested file could not be found in the current directory, in the TeX
-search path or in the LaTeX search path.
-! LaTeX3 Error: File 'NotAFile.xxx.yyy.zzz' not found.
-For immediate help type H <return>.
- ...
-l. ... }
-The requested file could not be found in the current directory, in the TeX
-search path or in the LaTeX search path.
-! LaTeX3 Error: File 'NotAFile.xxx.yyy.zzz' not found.
-For immediate help type H <return>.
- ...
-l. ... }
-The requested file could not be found in the current directory, in the TeX
-search path or in the LaTeX search path.
|A|
============================================================
More information about the latex3-commits
mailing list