[latex3-commits] [git/LaTeX3-latex3-latex2e] misused-replacing-args: Add test for a5b1e05 (0fe0a881)

PhelypeOleinik phelype.oleinik at latex-project.org
Mon Apr 17 02:30:12 CEST 2023


Repository : https://github.com/latex3/latex2e
On branch  : misused-replacing-args
Link       : https://github.com/latex3/latex2e/commit/0fe0a881f873d3b5238dfbd65d9a526b901a8b79

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

commit 0fe0a881f873d3b5238dfbd65d9a526b901a8b79
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date:   Sun Apr 16 21:30:12 2023 -0300

    Add test for a5b1e05


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

0fe0a881f873d3b5238dfbd65d9a526b901a8b79
 base/testfiles-lthooks/lthooks-033.lvt | 31 ++++++++++++--
 base/testfiles-lthooks/lthooks-033.tlg | 78 ++++++++++++++++++++++++++++++----
 2 files changed, 96 insertions(+), 13 deletions(-)

diff --git a/base/testfiles-lthooks/lthooks-033.lvt b/base/testfiles-lthooks/lthooks-033.lvt
index 22f84c5c..f60ed623 100644
--- a/base/testfiles-lthooks/lthooks-033.lvt
+++ b/base/testfiles-lthooks/lthooks-033.lvt
@@ -8,12 +8,35 @@
 
 \documentclass{minimal}
 
-\begin{document}
-
 \START
 
-\let\ashow\show
-\def\cshow#1{\expandafter\show\csname#1\endcsname}
+\makeatletter
+\TEST{Add with hooks, but declare without}
+  {
+    \def\@foohook{\typeout{foo legacy code ##1}}
+    \NewHook{foo}
+    \ShowHook{foo}
+    \UseHook{foo}
+    %
+    \def\@fooarghook{\typeout{fooarg legacy code ##1}}
+    \NewHookWithArguments{fooarg}{1}
+    \ShowHook{fooarg}
+    \UseHook{fooarg}{ERR}
+    %
+    \NewHook{bar}
+    \def\@barhook{\typeout{bar legacy code ##1}}
+    \ShowHook{bar}
+    \UseHook{bar}
+    %
+    \NewHookWithArguments{bararg}{1}
+    \def\@bararghook{\typeout{bararg legacy code ##1}}
+    \ShowHook{bararg}
+    \UseHook{bararg}{ERR}
+  }
+
+\OMIT
+\begin{document}
+\TIMO
 
 \TEST{Two arguments}
   {
diff --git a/base/testfiles-lthooks/lthooks-033.tlg b/base/testfiles-lthooks/lthooks-033.tlg
index 1db4c8b0..5cd3f27f 100644
--- a/base/testfiles-lthooks/lthooks-033.tlg
+++ b/base/testfiles-lthooks/lthooks-033.tlg
@@ -1,7 +1,67 @@
 This is a generated file for the l3build validation system.
 Don't change this file in any respect.
 ============================================================
-TEST 1: Two arguments
+TEST 1: Add with hooks, but declare without
+============================================================
+-> The hook 'foo':
+> Code chunks:
+>     legacy -> \typeout {foo legacy code ##1}
+> Document-level (top-level) code (executed last):
+>     ---
+> Extra code for next invocation:
+>     ---
+> Rules:
+>     ---
+> Execution order:
+>     legacy.
+<recently read> }
+l. ...  }
+foo legacy code ##1
+-> The hook 'fooarg' (1 argument):
+> Code chunks:
+>     legacy -> \typeout {fooarg legacy code ##1}
+> Document-level (top-level) code (executed last):
+>     ---
+> Extra code for next invocation:
+>     ---
+> Rules:
+>     ---
+> Execution order:
+>     legacy.
+<recently read> }
+l. ...  }
+fooarg legacy code ##1
+-> The hook 'bar':
+> Code chunks:
+>     legacy -> \typeout {bar legacy code ##1}
+> Document-level (top-level) code (executed last):
+>     ---
+> Extra code for next invocation:
+>     ---
+> Rules:
+>     ---
+> Execution order:
+>     legacy.
+<recently read> }
+l. ...  }
+bar legacy code ##1
+-> The hook 'bararg' (1 argument):
+> Code chunks:
+>     legacy -> \typeout {bararg legacy code ##1}
+> Document-level (top-level) code (executed last):
+>     ---
+> Extra code for next invocation:
+>     ---
+> Rules:
+>     ---
+> Execution order:
+>     legacy.
+<recently read> }
+l. ...  }
+bararg legacy code ##1
+============================================================
+============================================================
+TEST 2: Two arguments
 ============================================================
 -> The hook 'test-2' (2 arguments):
 > Code chunks:
@@ -30,7 +90,7 @@ next-hashes(##1,##2)
 next-args(foo,bar)
 ============================================================
 ============================================================
-TEST 2: One argument
+TEST 3: One argument
 ============================================================
 ! Illegal parameter number in definition of \__hook_toplevel test-1.
 <to be read again> 
@@ -116,7 +176,7 @@ next-args(foo,##2)
 l. ...  }
 ============================================================
 ============================================================
-TEST 3: Zero arguments
+TEST 4: Zero arguments
 ============================================================
 ! LaTeX hooks Error: Hook 'test-0' has no arguments.
 For immediate help type H <return>.
@@ -189,7 +249,7 @@ next-hashes(##1,##2)
 next-args(##1,##2)
 ============================================================
 ============================================================
-TEST 4: Ten arguments
+TEST 5: Ten arguments
 ============================================================
 ! LaTeX hooks Error: Too many arguments for hook 'test-10'.
 For immediate help type H <return>.
@@ -215,7 +275,7 @@ l. ...  }
 10-next(foo,bar)
 ============================================================
 ============================================================
-TEST 5: No arguments
+TEST 6: No arguments
 ============================================================
 ! LaTeX hooks Error: Hook 'no-args' has no arguments.
 For immediate help type H <return>.
@@ -247,7 +307,7 @@ no-next(##1,##2)
 no-next(##1,##2)
 ============================================================
 ============================================================
-TEST 6: One-time hook with arguments
+TEST 7: One-time hook with arguments
 ============================================================
 -> The hook 'use-once' (2 arguments):
 > Code chunks:
@@ -279,7 +339,7 @@ twice(##1,##2)
 l. ...  }
 ============================================================
 ============================================================
-TEST 7: Add with arguments before hook is declared
+TEST 8: Add with arguments before hook is declared
 ============================================================
 -> The hook 'not-declared':
 > The hook is not declared.
@@ -322,7 +382,7 @@ next-more-args(foo,bar)
 next-more-hashes(##1,##2)
 ============================================================
 ============================================================
-TEST 8: Testing with nine arguments
+TEST 9: Testing with nine arguments
 ============================================================
 -> The hook 'not-nine':
 > The hook is not declared.
@@ -365,7 +425,7 @@ next-more-args(foo,bar)
 next-more-hashes(##1,##9)
 ============================================================
 ============================================================
-TEST 9: Add with hooks, but declare without
+TEST 10: Add with hooks, but declare without
 ============================================================
 -> The hook 'liar':
 > The hook is not declared.





More information about the latex3-commits mailing list.