[latex3-commits] [latex3/latex2e] cmd-args: Add tests for cmd hooks with args (9e2b3f73)
github at latex-project.org
github at latex-project.org
Thu May 18 06:18:41 CEST 2023
Repository : https://github.com/latex3/latex2e
On branch : cmd-args
Link : https://github.com/latex3/latex2e/commit/9e2b3f73e9a6834a5d2790dd8833fc2f71be35c3
>---------------------------------------------------------------
commit 9e2b3f73e9a6834a5d2790dd8833fc2f71be35c3
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date: Thu May 18 01:18:41 2023 -0300
Add tests for cmd hooks with args
>---------------------------------------------------------------
9e2b3f73e9a6834a5d2790dd8833fc2f71be35c3
base/testfiles-lthooks/ltcmdhooks-013.lvt | 34 ++++++++
base/testfiles-lthooks/ltcmdhooks-013.tlg | 129 ++++++++++++++++++++++++++++++
base/testfiles-lthooks/ltcmdhooks-014.lvt | 34 ++++++++
base/testfiles-lthooks/ltcmdhooks-014.tlg | 128 +++++++++++++++++++++++++++++
base/testfiles-lthooks/ltcmdhooks-015.lvt | 34 ++++++++
base/testfiles-lthooks/ltcmdhooks-015.tlg | 128 +++++++++++++++++++++++++++++
6 files changed, 487 insertions(+)
diff --git a/base/testfiles-lthooks/ltcmdhooks-013.lvt b/base/testfiles-lthooks/ltcmdhooks-013.lvt
new file mode 100755
index 00000000..2a53519d
--- /dev/null
+++ b/base/testfiles-lthooks/ltcmdhooks-013.lvt
@@ -0,0 +1,34 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\RequirePackage[enable-debug,check-declarations]{expl3}
+\ExplSyntaxOn
+\debug_on:n { deprecation }
+\ExplSyntaxOff
+
+\input{regression-test}
+
+\START
+
+\def\bar#1{\typeout{[bar/body] (#1)}}
+
+\AddToHookWithArguments{cmdfoobefore}[X]{\typeout{[foo/before] (#1)}}
+\AddToHookWithArguments{cmd/foo/before}[X]{\typeout{[foo/before] (#1)}}
+\AddToHookWithArguments{cmd/bar/before}[X]{\typeout{[bar/before] (#1)}}
+\AddToHookWithArguments{cmd/bar/after}[X]{\typeout{[bar/after] (#2)}}
+
+\ShowHook{cmdfoobefore}
+\ShowHook{cmd/foo/before} % (unknown arguments)
+
+\show\bar
+\ShowHook{cmd/bar/before} % (unknown arguments)
+\ShowHook{cmd/bar/after} % (unknown arguments)
+
+\csname __hook_cmd_begindocument_code:\endcsname % \begin{document}
+
+\ShowHook{cmdfoobefore}
+\ShowHook{cmd/foo/before} % (9 arguments)
+
+\show\bar
+\ShowHook{cmd/bar/before} % (1 argument)
+\ShowHook{cmd/bar/after} % (1 argument)
+
+\END
diff --git a/base/testfiles-lthooks/ltcmdhooks-013.tlg b/base/testfiles-lthooks/ltcmdhooks-013.tlg
new file mode 100755
index 00000000..9be4cc1a
--- /dev/null
+++ b/base/testfiles-lthooks/ltcmdhooks-013.tlg
@@ -0,0 +1,129 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+-> The hook 'cmdfoobefore':
+> The hook is not declared.
+> Code chunks:
+> X -> \typeout {[foo/before] (#1)}
+> Document-level (top-level) code:
+> ---
+> Extra code for next invocation:
+> ---
+> Rules:
+> ---
+> Execution order:
+> Not set because the hook is undeclared.
+<recently read> }
+l. ...\ShowHook{cmdfoobefore}
+-> The generic hook 'cmd/foo/before' (unknown arguments):
+> Code chunks:
+> X -> \typeout {[foo/before] (#1)}
+> Document-level (top-level) code (executed last):
+> ---
+> Extra code for next invocation:
+> ---
+> Rules:
+> ---
+> Execution order:
+> X.
+<recently read> }
+l. ...\ShowHook{cmd/foo/before}
+ % (unknown arguments)
+> \bar=macro:
+#1->\typeout {[bar/body] (#1)}.
+l. ...\show\bar
+-> The generic hook 'cmd/bar/before' (unknown arguments):
+> Code chunks:
+> X -> \typeout {[bar/before] (#1)}
+> Document-level (top-level) code (executed last):
+> ---
+> Extra code for next invocation:
+> ---
+> Rules:
+> ---
+> Execution order:
+> X.
+<recently read> }
+l. ...\ShowHook{cmd/bar/before}
+ % (unknown arguments)
+-> The generic hook 'cmd/bar/after' (unknown arguments):
+> Code chunks:
+> X -> \typeout {[bar/after] (#2)}
+> Document-level (top-level) code (executed first):
+> ---
+> Extra code for next invocation:
+> ---
+> Rules:
+> ---
+> Execution order (after reversal):
+> X.
+<recently read> }
+l. ...\ShowHook{cmd/bar/after}
+ % (unknown arguments)
+! Illegal parameter number in definition of hook 'cmd/bar/after'.
+(hooks) Offending label: 'X'.
+<to be read again>
+ 2
+l. ......e __hook_cmd_begindocument_code:\endcsname
+ % \begin{document}
+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 ##.
+-> The hook 'cmdfoobefore':
+> The hook is not declared.
+> Code chunks:
+> X -> \typeout {[foo/before] (#1)}
+> Document-level (top-level) code:
+> ---
+> Extra code for next invocation:
+> ---
+> Rules:
+> ---
+> Execution order:
+> Not set because the hook is undeclared.
+<recently read> }
+l. ...\ShowHook{cmdfoobefore}
+-> The generic hook 'cmd/foo/before' (9 arguments):
+> Code chunks:
+> X -> \typeout {[foo/before] (#1)}
+> Document-level (top-level) code (executed last):
+> ---
+> Extra code for next invocation:
+> ---
+> Rules:
+> ---
+> Execution order:
+> X.
+<recently read> }
+l. ...\ShowHook{cmd/foo/before}
+ % (9 arguments)
+> \bar=macro:
+#1->\UseHookWithArguments {cmd/bar/before}{1}{#1}\typeout {[bar/body] (#1)}\UseHookWithArguments {cmd/bar/after}{1}{#1}.
+l. ...\show\bar
+-> The generic hook 'cmd/bar/before' (1 argument):
+> Code chunks:
+> X -> \typeout {[bar/before] (#1)}
+> Document-level (top-level) code (executed last):
+> ---
+> Extra code for next invocation:
+> ---
+> Rules:
+> ---
+> Execution order:
+> X.
+<recently read> }
+l. ...\ShowHook{cmd/bar/before}
+ % (1 argument)
+-> The generic hook 'cmd/bar/after' (1 argument):
+> Code chunks:
+> X -> \typeout {[bar/after] (##2)}
+> Document-level (top-level) code (executed first):
+> ---
+> Extra code for next invocation:
+> ---
+> Rules:
+> ---
+> Execution order (after reversal):
+> X.
+<recently read> }
+l. ...\ShowHook{cmd/bar/after}
+ % (1 argument)
diff --git a/base/testfiles-lthooks/ltcmdhooks-014.lvt b/base/testfiles-lthooks/ltcmdhooks-014.lvt
new file mode 100755
index 00000000..c83d6aac
--- /dev/null
+++ b/base/testfiles-lthooks/ltcmdhooks-014.lvt
@@ -0,0 +1,34 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\RequirePackage[enable-debug,check-declarations]{expl3}
+\ExplSyntaxOn
+\debug_on:n { deprecation }
+\ExplSyntaxOff
+
+\input{regression-test}
+
+\START
+
+\def\bar#1{\typeout{[bar/body] (#1)}}
+
+\AddToHookWithArguments{cmdfoobefore}[top-level]{\typeout{[foo/before] (#1)}}
+\AddToHookWithArguments{cmd/foo/before}[top-level]{\typeout{[foo/before] (#1)}}
+\AddToHookWithArguments{cmd/bar/before}[top-level]{\typeout{[bar/before] (#1)}}
+\AddToHookWithArguments{cmd/bar/after}[top-level]{\typeout{[bar/after] (#2)}}
+
+\ShowHook{cmdfoobefore}
+\ShowHook{cmd/foo/before} % (unknown arguments)
+
+\show\bar
+\ShowHook{cmd/bar/before} % (unknown arguments)
+\ShowHook{cmd/bar/after} % (unknown arguments)
+
+\csname __hook_cmd_begindocument_code:\endcsname % \begin{document}
+
+\ShowHook{cmdfoobefore}
+\ShowHook{cmd/foo/before} % (9 arguments)
+
+\show\bar
+\ShowHook{cmd/bar/before} % (1 argument)
+\ShowHook{cmd/bar/after} % (1 argument)
+
+\END
diff --git a/base/testfiles-lthooks/ltcmdhooks-014.tlg b/base/testfiles-lthooks/ltcmdhooks-014.tlg
new file mode 100755
index 00000000..af52883e
--- /dev/null
+++ b/base/testfiles-lthooks/ltcmdhooks-014.tlg
@@ -0,0 +1,128 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+-> The hook 'cmdfoobefore':
+> The hook is not declared.
+> Code chunks:
+> ---
+> Document-level (top-level) code:
+> -> \typeout {[foo/before] (#1)}
+> Extra code for next invocation:
+> ---
+> Rules:
+> ---
+> Execution order:
+> Not set because the hook is undeclared.
+<recently read> }
+l. ...\ShowHook{cmdfoobefore}
+-> The generic hook 'cmd/foo/before' (unknown arguments):
+> Code chunks:
+> ---
+> Document-level (top-level) code (executed last):
+> -> \typeout {[foo/before] (#1)}
+> Extra code for next invocation:
+> ---
+> Rules:
+> ---
+> Execution order:
+> ---.
+<recently read> }
+l. ...\ShowHook{cmd/foo/before}
+ % (unknown arguments)
+> \bar=macro:
+#1->\typeout {[bar/body] (#1)}.
+l. ...\show\bar
+-> The generic hook 'cmd/bar/before' (unknown arguments):
+> Code chunks:
+> ---
+> Document-level (top-level) code (executed last):
+> -> \typeout {[bar/before] (#1)}
+> Extra code for next invocation:
+> ---
+> Rules:
+> ---
+> Execution order:
+> ---.
+<recently read> }
+l. ...\ShowHook{cmd/bar/before}
+ % (unknown arguments)
+-> The generic hook 'cmd/bar/after' (unknown arguments):
+> Code chunks:
+> ---
+> Document-level (top-level) code (executed first):
+> -> \typeout {[bar/after] (#2)}
+> Extra code for next invocation:
+> ---
+> Rules:
+> ---
+> Execution order (after reversal):
+> ---.
+<recently read> }
+l. ...\ShowHook{cmd/bar/after}
+ % (unknown arguments)
+! Illegal parameter number in definition of \__hook_toplevel cmd/bar/after.
+<to be read again>
+ 2
+l. ......e __hook_cmd_begindocument_code:\endcsname
+ % \begin{document}
+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 ##.
+-> The hook 'cmdfoobefore':
+> The hook is not declared.
+> Code chunks:
+> ---
+> Document-level (top-level) code:
+> -> \typeout {[foo/before] (#1)}
+> Extra code for next invocation:
+> ---
+> Rules:
+> ---
+> Execution order:
+> Not set because the hook is undeclared.
+<recently read> }
+l. ...\ShowHook{cmdfoobefore}
+-> The generic hook 'cmd/foo/before' (9 arguments):
+> Code chunks:
+> ---
+> Document-level (top-level) code (executed last):
+> -> \typeout {[foo/before] (#1)}
+> Extra code for next invocation:
+> ---
+> Rules:
+> ---
+> Execution order:
+> ---.
+<recently read> }
+l. ...\ShowHook{cmd/foo/before}
+ % (9 arguments)
+> \bar=macro:
+#1->\UseHookWithArguments {cmd/bar/before}{1}{#1}\typeout {[bar/body] (#1)}\UseHookWithArguments {cmd/bar/after}{1}{#1}.
+l. ...\show\bar
+-> The generic hook 'cmd/bar/before' (1 argument):
+> Code chunks:
+> ---
+> Document-level (top-level) code (executed last):
+> -> \typeout {[bar/before] (#1)}
+> Extra code for next invocation:
+> ---
+> Rules:
+> ---
+> Execution order:
+> ---.
+<recently read> }
+l. ...\ShowHook{cmd/bar/before}
+ % (1 argument)
+-> The generic hook 'cmd/bar/after' (1 argument):
+> Code chunks:
+> ---
+> Document-level (top-level) code (executed first):
+> -> \typeout {[bar/after] (##2)}
+> Extra code for next invocation:
+> ---
+> Rules:
+> ---
+> Execution order (after reversal):
+> ---.
+<recently read> }
+l. ...\ShowHook{cmd/bar/after}
+ % (1 argument)
diff --git a/base/testfiles-lthooks/ltcmdhooks-015.lvt b/base/testfiles-lthooks/ltcmdhooks-015.lvt
new file mode 100755
index 00000000..c0412d74
--- /dev/null
+++ b/base/testfiles-lthooks/ltcmdhooks-015.lvt
@@ -0,0 +1,34 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\RequirePackage[enable-debug,check-declarations]{expl3}
+\ExplSyntaxOn
+\debug_on:n { deprecation }
+\ExplSyntaxOff
+
+\input{regression-test}
+
+\START
+
+\def\bar#1{\typeout{[bar/body] (#1)}}
+
+\AddToHookNextWithArguments{cmdfoobefore}{\typeout{[foo/before] (#1)}}
+\AddToHookNextWithArguments{cmd/foo/before}{\typeout{[foo/before] (#1)}}
+\AddToHookNextWithArguments{cmd/bar/before}{\typeout{[bar/before] (#1)}}
+\AddToHookNextWithArguments{cmd/bar/after}{\typeout{[bar/after] (#2)}}
+
+\ShowHook{cmdfoobefore}
+\ShowHook{cmd/foo/before} % (unknown arguments)
+
+\show\bar
+\ShowHook{cmd/bar/before} % (unknown arguments)
+\ShowHook{cmd/bar/after} % (unknown arguments)
+
+\csname __hook_cmd_begindocument_code:\endcsname % \begin{document}
+
+\ShowHook{cmdfoobefore}
+\ShowHook{cmd/foo/before} % (9 arguments)
+
+\show\bar
+\ShowHook{cmd/bar/before} % (1 argument)
+\ShowHook{cmd/bar/after} % (1 argument)
+
+\END
diff --git a/base/testfiles-lthooks/ltcmdhooks-015.tlg b/base/testfiles-lthooks/ltcmdhooks-015.tlg
new file mode 100755
index 00000000..7b057353
--- /dev/null
+++ b/base/testfiles-lthooks/ltcmdhooks-015.tlg
@@ -0,0 +1,128 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+-> The hook 'cmdfoobefore':
+> The hook is not declared.
+> Code chunks:
+> ---
+> Document-level (top-level) code:
+> ---
+> Extra code for next invocation:
+> -> \typeout {[foo/before] (#1)}
+> Rules:
+> ---
+> Execution order:
+> Not set because the hook is undeclared.
+<recently read> }
+l. ...\ShowHook{cmdfoobefore}
+-> The generic hook 'cmd/foo/before' (unknown arguments):
+> Code chunks:
+> ---
+> Document-level (top-level) code (executed last):
+> ---
+> Extra code for next invocation:
+> -> \typeout {[foo/before] (#1)}
+> Rules:
+> ---
+> Execution order:
+> ---.
+<recently read> }
+l. ...\ShowHook{cmd/foo/before}
+ % (unknown arguments)
+> \bar=macro:
+#1->\typeout {[bar/body] (#1)}.
+l. ...\show\bar
+-> The generic hook 'cmd/bar/before' (unknown arguments):
+> Code chunks:
+> ---
+> Document-level (top-level) code (executed last):
+> ---
+> Extra code for next invocation:
+> -> \typeout {[bar/before] (#1)}
+> Rules:
+> ---
+> Execution order:
+> ---.
+<recently read> }
+l. ...\ShowHook{cmd/bar/before}
+ % (unknown arguments)
+-> The generic hook 'cmd/bar/after' (unknown arguments):
+> Code chunks:
+> ---
+> Document-level (top-level) code (executed first):
+> ---
+> Extra code for next invocation:
+> -> \typeout {[bar/after] (#2)}
+> Rules:
+> ---
+> Execution order (after reversal):
+> ---.
+<recently read> }
+l. ...\ShowHook{cmd/bar/after}
+ % (unknown arguments)
+! Illegal parameter number in definition of \__hook_next cmd/bar/after.
+<to be read again>
+ 2
+l. ......e __hook_cmd_begindocument_code:\endcsname
+ % \begin{document}
+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 ##.
+-> The hook 'cmdfoobefore':
+> The hook is not declared.
+> Code chunks:
+> ---
+> Document-level (top-level) code:
+> ---
+> Extra code for next invocation:
+> -> \typeout {[foo/before] (#1)}
+> Rules:
+> ---
+> Execution order:
+> Not set because the hook is undeclared.
+<recently read> }
+l. ...\ShowHook{cmdfoobefore}
+-> The generic hook 'cmd/foo/before' (9 arguments):
+> Code chunks:
+> ---
+> Document-level (top-level) code (executed last):
+> ---
+> Extra code for next invocation:
+> -> \typeout {[foo/before] (#1)}
+> Rules:
+> ---
+> Execution order:
+> ---.
+<recently read> }
+l. ...\ShowHook{cmd/foo/before}
+ % (9 arguments)
+> \bar=macro:
+#1->\UseHookWithArguments {cmd/bar/before}{1}{#1}\typeout {[bar/body] (#1)}\UseHookWithArguments {cmd/bar/after}{1}{#1}.
+l. ...\show\bar
+-> The generic hook 'cmd/bar/before' (1 argument):
+> Code chunks:
+> ---
+> Document-level (top-level) code (executed last):
+> ---
+> Extra code for next invocation:
+> -> \typeout {[bar/before] (#1)}
+> Rules:
+> ---
+> Execution order:
+> ---.
+<recently read> }
+l. ...\ShowHook{cmd/bar/before}
+ % (1 argument)
+-> The generic hook 'cmd/bar/after' (1 argument):
+> Code chunks:
+> ---
+> Document-level (top-level) code (executed first):
+> ---
+> Extra code for next invocation:
+> -> \typeout {[bar/after] (##2)}
+> Rules:
+> ---
+> Execution order (after reversal):
+> ---.
+<recently read> }
+l. ...\ShowHook{cmd/bar/after}
+ % (1 argument)
More information about the latex3-commits
mailing list.