[latex3-commits] [git/LaTeX3-latex3-latex2e] hook-args: Tidy up test file (0de56d73)
PhelypeOleinik
phelype.oleinik at latex-project.org
Sat Mar 11 03:06:36 CET 2023
Repository : https://github.com/latex3/latex2e
On branch : hook-args
Link : https://github.com/latex3/latex2e/commit/0de56d73bdf8cc2afbd13c92904a2029a0e2f71d
>---------------------------------------------------------------
commit 0de56d73bdf8cc2afbd13c92904a2029a0e2f71d
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date: Sun Feb 5 23:31:27 2023 -0300
Tidy up test file
>---------------------------------------------------------------
0de56d73bdf8cc2afbd13c92904a2029a0e2f71d
base/testfiles-lthooks/lthooks-033.lvt | 174 +++++++++++++++++----------------
base/testfiles-lthooks/lthooks-033.tlg | 70 +++++++------
2 files changed, 134 insertions(+), 110 deletions(-)
diff --git a/base/testfiles-lthooks/lthooks-033.lvt b/base/testfiles-lthooks/lthooks-033.lvt
index 21def8e3..c8b1344a 100644
--- a/base/testfiles-lthooks/lthooks-033.lvt
+++ b/base/testfiles-lthooks/lthooks-033.lvt
@@ -4,7 +4,6 @@
% \debug_on:n { check-declarations , deprecation }
% \ExplSyntaxOff
-
\input{regression-test}
\documentclass{minimal}
@@ -16,98 +15,109 @@
\let\ashow\show
\def\cshow#1{\expandafter\show\csname#1\endcsname}
-\typeout{--- Test with two arguments}
-\def\hookname{test-2}
-\NewHookWithArguments{\hookname}{2}
-% top-level
-\AddToHook{\hookname}{\typeout{top-hashes(#1,#2)}}
-\AddToHookWithArguments{\hookname}{\typeout{top-args(#1,#2)}}
-\AddToHook{\hookname}{\typeout{top-hashes(#1,#2)}}
-\AddToHookWithArguments{\hookname}{\typeout{top-args(#1,#2)}}
-% next
-\AddToHookNext{\hookname}{\typeout{next-hashes(#1,#2)}}
-\AddToHookNextWithArguments{\hookname}{\typeout{next-args(#1,#2)}}
-\AddToHookNext{\hookname}{\typeout{next-hashes(#1,#2)}}
-\AddToHookNextWithArguments{\hookname}{\typeout{next-args(#1,#2)}}
-% label
-\AddToHook{\hookname}[label]{\typeout{label-hashes(#1,#2)}}
-\AddToHookWithArguments{\hookname}[label]{\typeout{label-args(#1,#2)}}
-\AddToHook{\hookname}[label]{\typeout{label-hashes(#1,#2)}}
-\AddToHookWithArguments{\hookname}[label]{\typeout{label-args(#1,#2)}}
-
-\UseHook{\hookname}{foo}{bar}
+\TEST{Two arguments}
+ {
+ \def\hookname{test-2}
+ \NewHookWithArguments{\hookname}{2}
+ % top-level
+ \AddToHook{\hookname}{\typeout{top-hashes(#1,#2)}}
+ \AddToHookWithArguments{\hookname}{\typeout{top-args(#1,#2)}}
+ \AddToHook{\hookname}{\typeout{top-hashes(#1,#2)}}
+ \AddToHookWithArguments{\hookname}{\typeout{top-args(#1,#2)}}
+ % next
+ \AddToHookNext{\hookname}{\typeout{next-hashes(#1,#2)}}
+ \AddToHookNextWithArguments{\hookname}{\typeout{next-args(#1,#2)}}
+ \AddToHookNext{\hookname}{\typeout{next-hashes(#1,#2)}}
+ \AddToHookNextWithArguments{\hookname}{\typeout{next-args(#1,#2)}}
+ % label
+ \AddToHook{\hookname}[label]{\typeout{label-hashes(#1,#2)}}
+ \AddToHookWithArguments{\hookname}[label]{\typeout{label-args(#1,#2)}}
+ \AddToHook{\hookname}[label]{\typeout{label-hashes(#1,#2)}}
+ \AddToHookWithArguments{\hookname}[label]{\typeout{label-args(#1,#2)}}
+
+ \UseHook{\hookname}{foo}{bar}
+ }
%
-\typeout{--- Test with one argument}
-\def\hookname{test-1}
-\NewHookWithArguments{\hookname}{1}
-% top-level
-\AddToHook{\hookname}{\typeout{top-hashes(#1,#2)}}
-\AddToHookWithArguments{\hookname}{\typeout{top-args(#1,#2)}}
-\AddToHook{\hookname}{\typeout{top-hashes(#1,#2)}}
-\AddToHookWithArguments{\hookname}{\typeout{top-args(#1,#2)}}
-% next
-\AddToHookNext{\hookname}{\typeout{next-hashes(#1,#2)}}
-\AddToHookNextWithArguments{\hookname}{\typeout{next-args(#1,#2)}}
-\AddToHookNext{\hookname}{\typeout{next-hashes(#1,#2)}}
-\AddToHookNextWithArguments{\hookname}{\typeout{next-args(#1,#2)}}
-% label
-\AddToHook{\hookname}[label]{\typeout{label-hashes(#1,#2)}}
-\AddToHookWithArguments{\hookname}[label]{\typeout{label-args(#1,#2)}}
-\AddToHook{\hookname}[label]{\typeout{label-hashes(#1,#2)}}
-\AddToHookWithArguments{\hookname}[label]{\typeout{label-args(#1,#2)}}
-
-\UseHook{\hookname}{foo}{bar}
+\TEST{One argument}
+ {
+ \def\hookname{test-1}
+ \NewHookWithArguments{\hookname}{1}
+ % top-level
+ \AddToHook{\hookname}{\typeout{top-hashes(#1,#2)}}
+ \AddToHookWithArguments{\hookname}{\typeout{top-args(#1,#2)}}
+ \AddToHook{\hookname}{\typeout{top-hashes(#1,#2)}}
+ \AddToHookWithArguments{\hookname}{\typeout{top-args(#1,#2)}}
+ % next
+ \AddToHookNext{\hookname}{\typeout{next-hashes(#1,#2)}}
+ \AddToHookNextWithArguments{\hookname}{\typeout{next-args(#1,#2)}}
+ \AddToHookNext{\hookname}{\typeout{next-hashes(#1,#2)}}
+ \AddToHookNextWithArguments{\hookname}{\typeout{next-args(#1,#2)}}
+ % label
+ \AddToHook{\hookname}[label]{\typeout{label-hashes(#1,#2)}}
+ \AddToHookWithArguments{\hookname}[label]{\typeout{label-args(#1,#2)}}
+ \AddToHook{\hookname}[label]{\typeout{label-hashes(#1,#2)}}
+ \AddToHookWithArguments{\hookname}[label]{\typeout{label-args(#1,#2)}}
+
+ \UseHook{\hookname}{foo}{bar}
+ }
%
-\typeout{--- Test with zero arguments}
-\def\hookname{test-0}
-\NewHookWithArguments{\hookname}{0}
-% top-level
-\AddToHook{\hookname}{\typeout{top-hashes(#1,#2)}}
-\AddToHookWithArguments{\hookname}{\typeout{top-args(#1,#2)}}
-\AddToHook{\hookname}{\typeout{top-hashes(#1,#2)}}
-\AddToHookWithArguments{\hookname}{\typeout{top-args(#1,#2)}}
-% next
-\AddToHookNext{\hookname}{\typeout{next-hashes(#1,#2)}}
-\AddToHookNextWithArguments{\hookname}{\typeout{next-args(#1,#2)}}
-\AddToHookNext{\hookname}{\typeout{next-hashes(#1,#2)}}
-\AddToHookNextWithArguments{\hookname}{\typeout{next-args(#1,#2)}}
-% label
-\AddToHook{\hookname}[label]{\typeout{label-hashes(#1,#2)}}
-\AddToHookWithArguments{\hookname}[label]{\typeout{label-args(#1,#2)}}
-\AddToHook{\hookname}[label]{\typeout{label-hashes(#1,#2)}}
-\AddToHookWithArguments{\hookname}[label]{\typeout{label-args(#1,#2)}}
-
-\UseHook{\hookname}{foo}{bar}
+\TEST{Zero arguments}
+ {
+ \def\hookname{test-0}
+ \NewHookWithArguments{\hookname}{0}
+ % top-level
+ \AddToHook{\hookname}{\typeout{top-hashes(#1,#2)}}
+ \AddToHookWithArguments{\hookname}{\typeout{top-args(#1,#2)}}
+ \AddToHook{\hookname}{\typeout{top-hashes(#1,#2)}}
+ \AddToHookWithArguments{\hookname}{\typeout{top-args(#1,#2)}}
+ % next
+ \AddToHookNext{\hookname}{\typeout{next-hashes(#1,#2)}}
+ \AddToHookNextWithArguments{\hookname}{\typeout{next-args(#1,#2)}}
+ \AddToHookNext{\hookname}{\typeout{next-hashes(#1,#2)}}
+ \AddToHookNextWithArguments{\hookname}{\typeout{next-args(#1,#2)}}
+ % label
+ \AddToHook{\hookname}[label]{\typeout{label-hashes(#1,#2)}}
+ \AddToHookWithArguments{\hookname}[label]{\typeout{label-args(#1,#2)}}
+ \AddToHook{\hookname}[label]{\typeout{label-hashes(#1,#2)}}
+ \AddToHookWithArguments{\hookname}[label]{\typeout{label-args(#1,#2)}}
+
+ \UseHook{\hookname}{foo}{bar}
+ }
%
-\typeout{--- Test with ten arguments}
-% Too many arguments, then LaTeX defines with zero, then
-% \AddToHookWithArguments complains... Maybe should define with 9?
-\NewHookWithArguments{test-10}{10}
-\AddToHookWithArguments{test-10}{\typeout{10-top-level(#1,#2)}}
-\AddToHookWithArguments{test-10}[label]{\typeout{10-label(#1,#2)}}
-\AddToHookNextWithArguments{test-10}{\typeout{10-next(#1,#2)}}
-\UseHook{test-10}{foo}{bar}
-
-\NewHook{no-args}
-\AddToHook{no-args}{\typeout{no-top-level(#1,#2)}} % ok, adds ##1, ##2
-\AddToHook{no-args}[label]{\typeout{no-label(#1,#2)}} % ok, adds ##1, ##2
-\AddToHookNext{no-args}{\typeout{no-next(#1,#2)}} % ok, adds ##1, ##2
-
-\AddToHookWithArguments{no-args}{\typeout{no-top-level(#1,#2)}} % error, adds ##1, ##2
-\AddToHookWithArguments{no-args}[label]{\typeout{no-label(#1,#2)}} % error, adds ##1, ##2
-\AddToHookNextWithArguments{no-args}{\typeout{no-next(#1,#2)}} % error, adds ##1, ##2
-\UseHook{no-args}
+\TEST{Ten arguments}
+ {
+ % Too many arguments, then LaTeX defines with zero, then
+ % \AddToHookWithArguments complains... Maybe should define with 9?
+ \NewHookWithArguments{test-10}{10}
+ \AddToHookWithArguments{test-10}{\typeout{10-top-level(#1,#2)}}
+ \AddToHookWithArguments{test-10}[label]{\typeout{10-label(#1,#2)}}
+ \AddToHookNextWithArguments{test-10}{\typeout{10-next(#1,#2)}}
+ \UseHook{test-10}{foo}{bar}
+
+ \NewHook{no-args}
+ \AddToHook{no-args}{\typeout{no-top-level(#1,#2)}} % ok, adds ##1, ##2
+ \AddToHook{no-args}[label]{\typeout{no-label(#1,#2)}} % ok, adds ##1, ##2
+ \AddToHookNext{no-args}{\typeout{no-next(#1,#2)}} % ok, adds ##1, ##2
+
+ \AddToHookWithArguments{no-args}{\typeout{no-top-level(#1,#2)}} % error, adds ##1, ##2
+ \AddToHookWithArguments{no-args}[label]{\typeout{no-label(#1,#2)}} % error, adds ##1, ##2
+ \AddToHookNextWithArguments{no-args}{\typeout{no-next(#1,#2)}} % error, adds ##1, ##2
+ \UseHook{no-args}
+ }
%
-\NewHookWithArguments{use-once}{2}
-\AddToHookWithArguments{use-once}{\typeout{once(#1,#2)}}
-\UseOneTimeHookWithArguments{use-once}{foo}{bar}
+\TEST{One-time hook with arguments}
+ {
+ \NewHookWithArguments{use-once}{2}
+ \AddToHookWithArguments{use-once}{\typeout{once(#1,#2)}}
+ \UseOneTimeHookWithArguments{use-once}{foo}{bar}
+ }
\END
diff --git a/base/testfiles-lthooks/lthooks-033.tlg b/base/testfiles-lthooks/lthooks-033.tlg
index 356d380b..e8c61fc2 100644
--- a/base/testfiles-lthooks/lthooks-033.tlg
+++ b/base/testfiles-lthooks/lthooks-033.tlg
@@ -1,6 +1,8 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
---- Test with two arguments
+============================================================
+TEST 1: Two arguments
+============================================================
label-hashes(##1,##2)
label-args(foo,bar)
label-hashes(##1,##2)
@@ -13,60 +15,63 @@ next-hashes(##1,##2)
next-args(foo,bar)
next-hashes(##1,##2)
next-args(foo,bar)
---- Test with one argument
+============================================================
+============================================================
+TEST 2: One argument
+============================================================
! Illegal parameter number in definition of \__hook_toplevel test-1.
<to be read again>
2
-l. ......ents{\hookname}{\typeout{top-args(#1,#2)}}
+l. ... }
You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.
! Illegal parameter number in definition of \__hook_toplevel test-1.
<to be read again>
2
-l. ......ents{\hookname}{\typeout{top-args(#1,#2)}}
+l. ... }
You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.
! Illegal parameter number in definition of \__hook_next test-1.
<to be read again>
2
-l. ......nts{\hookname}{\typeout{next-args(#1,#2)}}
+l. ... }
You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.
! Illegal parameter number in definition of \__hook_next test-1.
<to be read again>
2
-l. ......nts{\hookname}{\typeout{next-args(#1,#2)}}
+l. ... }
You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.
! Illegal parameter number in definition of \__hook test-1.
<to be read again>
2
-l. ......kname}[label]{\typeout{label-args(#1,#2)}}
+l. ... }
You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.
! Illegal parameter number in definition of \__hook test-1.
<to be read again>
2
-l. ......ame}[label]{\typeout{label-hashes(#1,#2)}}
+l. ... }
You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.
! Illegal parameter number in definition of \__hook test-1.
<to be read again>
2
-l. ......kname}[label]{\typeout{label-args(#1,#2)}}
+l. ... }
You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.
! Illegal parameter number in definition of \__hook test-1.
<to be read again>
2
-l. ......kname}[label]{\typeout{label-args(#1,#2)}}
+l. ... }
You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.
@@ -82,25 +87,28 @@ next-hashes(##1,##2)
next-args(foo,##2)
next-hashes(##1,##2)
next-args(foo,##2)
---- Test with zero arguments
+============================================================
+============================================================
+TEST 3: Zero arguments
+============================================================
! LaTeX hooks Error: Hook 'test-0' has no arguments.
For immediate help type H <return>.
...
-l. ......ents{\hookname}{\typeout{top-args(#1,#2)}}
+l. ... }
You tried to use \AddToHookWithArguments on a hook that takes no arguments.
Check the usage of the hook or use \AddToHook instead.
LaTeX will use \AddToHook.
! LaTeX hooks Error: Hook 'test-0' has no arguments.
For immediate help type H <return>.
...
-l. ......ents{\hookname}{\typeout{top-args(#1,#2)}}
+l. ... }
You tried to use \AddToHookWithArguments on a hook that takes no arguments.
Check the usage of the hook or use \AddToHook instead.
LaTeX will use \AddToHook.
! LaTeX hooks Error: Hook 'test-0' has no arguments.
For immediate help type H <return>.
...
-l. ......nts{\hookname}{\typeout{next-args(#1,#2)}}
+l. ... }
You tried to use \AddToHookNextWithArguments on a hook that takes no
arguments.
Check the usage of the hook or use \AddToHookNext instead.
@@ -108,7 +116,7 @@ LaTeX will use \AddToHookNext.
! LaTeX hooks Error: Hook 'test-0' has no arguments.
For immediate help type H <return>.
...
-l. ......nts{\hookname}{\typeout{next-args(#1,#2)}}
+l. ... }
You tried to use \AddToHookNextWithArguments on a hook that takes no
arguments.
Check the usage of the hook or use \AddToHookNext instead.
@@ -116,14 +124,14 @@ LaTeX will use \AddToHookNext.
! LaTeX hooks Error: Hook 'test-0' has no arguments.
For immediate help type H <return>.
...
-l. ......kname}[label]{\typeout{label-args(#1,#2)}}
+l. ... }
You tried to use \AddToHookWithArguments on a hook that takes no arguments.
Check the usage of the hook or use \AddToHook instead.
LaTeX will use \AddToHook.
! LaTeX hooks Error: Hook 'test-0' has no arguments.
For immediate help type H <return>.
...
-l. ......kname}[label]{\typeout{label-args(#1,#2)}}
+l. ... }
You tried to use \AddToHookWithArguments on a hook that takes no arguments.
Check the usage of the hook or use \AddToHook instead.
LaTeX will use \AddToHook.
@@ -139,31 +147,34 @@ next-hashes(##1,##2)
next-args(##1,##2)
next-hashes(##1,##2)
next-args(##1,##2)
---- Test with ten arguments
+============================================================
+============================================================
+TEST 4: Ten arguments
+============================================================
! LaTeX hooks Error: Too many arguments for hook 'test-10'.
For immediate help type H <return>.
...
-l. ...\NewHookWithArguments{test-10}{10}
+l. ... }
You tried to declare a hook with 10 arguments, but a hook can only have up to
nine. LaTeX will define this hook without arguments.
! LaTeX hooks Error: Hook 'test-10' has no arguments.
For immediate help type H <return>.
...
-l. ......ts{test-10}{\typeout{10-top-level(#1,#2)}}
+l. ... }
You tried to use \AddToHookWithArguments on a hook that takes no arguments.
Check the usage of the hook or use \AddToHook instead.
LaTeX will use \AddToHook.
! LaTeX hooks Error: Hook 'test-10' has no arguments.
For immediate help type H <return>.
...
-l. ......test-10}[label]{\typeout{10-label(#1,#2)}}
+l. ... }
You tried to use \AddToHookWithArguments on a hook that takes no arguments.
Check the usage of the hook or use \AddToHook instead.
LaTeX will use \AddToHook.
! LaTeX hooks Error: Hook 'test-10' has no arguments.
For immediate help type H <return>.
...
-l. ......guments{test-10}{\typeout{10-next(#1,#2)}}
+l. ... }
You tried to use \AddToHookNextWithArguments on a hook that takes no
arguments.
Check the usage of the hook or use \AddToHookNext instead.
@@ -174,24 +185,21 @@ LaTeX will use \AddToHookNext.
! LaTeX hooks Error: Hook 'no-args' has no arguments.
For immediate help type H <return>.
...
-l. ......s{no-args}{\typeout{no-top-level(#1,#2)}}
- % error, adds ##1, ##2
+l. ... }
You tried to use \AddToHookWithArguments on a hook that takes no arguments.
Check the usage of the hook or use \AddToHook instead.
LaTeX will use \AddToHook.
! LaTeX hooks Error: Hook 'no-args' has no arguments.
For immediate help type H <return>.
...
-l. ......o-args}[label]{\typeout{no-label(#1,#2)}}
- % error, adds ##1, ##2
+l. ... }
You tried to use \AddToHookWithArguments on a hook that takes no arguments.
Check the usage of the hook or use \AddToHook instead.
LaTeX will use \AddToHook.
! LaTeX hooks Error: Hook 'no-args' has no arguments.
For immediate help type H <return>.
...
-l. ......uments{no-args}{\typeout{no-next(#1,#2)}}
- % error, adds ##1, ##2
+l. ... }
You tried to use \AddToHookNextWithArguments on a hook that takes no
arguments.
Check the usage of the hook or use \AddToHookNext instead.
@@ -202,3 +210,9 @@ no-top-level(##1,##2)
no-top-level(##1,##2)
no-next(##1,##2)
no-next(##1,##2)
+============================================================
+============================================================
+TEST 5: One-time hook with arguments
+============================================================
+once(foo,bar)
+============================================================
More information about the latex3-commits
mailing list.