[latex3-commits] [git/LaTeX3-latex3-latex3] master: Add tests for shell functions (b827c328a)

PhelypeOleinik tex.phelype at gmail.com
Tue Mar 31 02:13:30 CEST 2020


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

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

commit b827c328aeeb59f33c7ffd0513e723ad15ef4b94
Author: PhelypeOleinik <tex.phelype at gmail.com>
Date:   Mon Mar 30 21:13:30 2020 -0300

    Add tests for shell functions


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

b827c328aeeb59f33c7ffd0513e723ad15ef4b94
 .../testfiles/m3shell001.luatex.tlg                | 26 +++++++-----
 l3kernel/testfiles/m3shell001.lvt                  | 49 ++++++++++++++++++++++
 .../testfiles/m3shell001.tlg                       | 26 +++++++-----
 3 files changed, 79 insertions(+), 22 deletions(-)

diff --git a/l3experimental/l3cctab/testfiles/m3cctab001.tlg b/l3kernel/testfiles/m3shell001.luatex.tlg
similarity index 52%
copy from l3experimental/l3cctab/testfiles/m3cctab001.tlg
copy to l3kernel/testfiles/m3shell001.luatex.tlg
index 394de4fe7..9352e3cef 100644
--- a/l3experimental/l3cctab/testfiles/m3cctab001.tlg
+++ b/l3kernel/testfiles/m3shell001.luatex.tlg
@@ -2,22 +2,26 @@ This is a generated file for the LaTeX (2e + expl3) validation system.
 Don't change this file in any respect.
 Author: Phelype Oleinik
 ============================================================
-TEST 1: cctab_begin/code in iniTeX
+TEST 1: \ior_shell_open:Nn 
 ============================================================
-OK
+> \l_tmpa_tl=Usage:bibtex[OPTION]...AUXFILE[.aux].
+<recently read> }
+l. ...  }
 ============================================================
 ============================================================
-TEST 2: cctab_begin/iniTeX in code
+TEST 2: \sys_get_shell:nnN 
 ============================================================
-OK
+("|bibtex --help")
+> \l_tmpa_tl=Usage: bibtex [OPTION]... AUXFILE[.aux] Write bibliography for
+entries in AUXFILE to AUXFILE.bbl, along with a log file AUXFILE.blg.
+-min-crossrefs=NUMBER include item after NUMBER cross-refs; default 2 -terse
+do not print progress reports -help display this help and exit -version output
+version information and exit Email bug reports to tex-k at tug.org. .
+<recently read> }
+l. ...  }
 ============================================================
 ============================================================
-TEST 3: cctab_begin/str in document
+TEST 3: \sys_shell_now:n 
 ============================================================
-OK
-============================================================
-============================================================
-TEST 4: cctab_begin/document in str
-============================================================
-OK
+runsystem(bibtex --help)...executed
 ============================================================
diff --git a/l3kernel/testfiles/m3shell001.lvt b/l3kernel/testfiles/m3shell001.lvt
new file mode 100644
index 000000000..eeff3ce04
--- /dev/null
+++ b/l3kernel/testfiles/m3shell001.lvt
@@ -0,0 +1,49 @@
+%
+% Copyright (C) 2020 The LaTeX3 Project
+%
+
+\documentclass{minimal}
+\input{regression-test}
+
+% Leave some padding so that the line numbers
+% of the tests don't change later on.
+
+\RequirePackage[enable-debug]{expl3}
+\ExplSyntaxOn
+\debug_on:n { check-declarations , deprecation , log-functions }
+\ExplSyntaxOff
+
+\START
+\AUTHOR{Phelype Oleinik}
+
+% This file contains tests for shell commands
+
+\ExplSyntaxOn
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\TEST { \ior_shell_open:Nn }
+  {
+    % Use BibTeX --help, as the commands available may vary
+    % and --shell-escape is not guaranteed.
+    \ior_shell_open:Nn \g_tmpa_ior { bibtex~--help }
+    \ior_get:NNTF \g_tmpa_ior \l_tmpa_tl
+      { \tl_show:N \l_tmpa_tl }
+      { \ERROR }
+  }
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\TEST { \sys_get_shell:nnN }
+  {
+    \sys_get_shell:nnNTF { bibtex~--help }
+      { \char_set_catcode_space:n { 32 } } \l_tmpa_tl
+      { \tl_show:N \l_tmpa_tl }
+      { \ERROR }
+  }
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\TEST { \sys_shell_now:n }
+  {
+    \sys_shell_now:n { bibtex~--help }
+  }
+
+\END
diff --git a/l3experimental/l3cctab/testfiles/m3cctab001.tlg b/l3kernel/testfiles/m3shell001.tlg
similarity index 52%
copy from l3experimental/l3cctab/testfiles/m3cctab001.tlg
copy to l3kernel/testfiles/m3shell001.tlg
index 394de4fe7..8199de913 100644
--- a/l3experimental/l3cctab/testfiles/m3cctab001.tlg
+++ b/l3kernel/testfiles/m3shell001.tlg
@@ -2,22 +2,26 @@ This is a generated file for the LaTeX (2e + expl3) validation system.
 Don't change this file in any respect.
 Author: Phelype Oleinik
 ============================================================
-TEST 1: cctab_begin/code in iniTeX
+TEST 1: \ior_shell_open:Nn 
 ============================================================
-OK
+> \l_tmpa_tl=Usage:bibtex[OPTION]...AUXFILE[.aux].
+<recently read> }
+l. ...  }
 ============================================================
 ============================================================
-TEST 2: cctab_begin/iniTeX in code
+TEST 2: \sys_get_shell:nnN 
 ============================================================
-OK
+(|bibtex --help)
+> \l_tmpa_tl=Usage: bibtex [OPTION]... AUXFILE[.aux] Write bibliography for
+entries in AUXFILE to AUXFILE.bbl, along with a log file AUXFILE.blg.
+-min-crossrefs=NUMBER include item after NUMBER cross-refs; default 2 -terse
+do not print progress reports -help display this help and exit -version output
+version information and exit Email bug reports to tex-k at tug.org. .
+<recently read> }
+l. ...  }
 ============================================================
 ============================================================
-TEST 3: cctab_begin/str in document
+TEST 3: \sys_shell_now:n 
 ============================================================
-OK
-============================================================
-============================================================
-TEST 4: cctab_begin/document in str
-============================================================
-OK
+runsystem(bibtex --help)...executed safely (allowed).
 ============================================================





More information about the latex3-commits mailing list.