[latex3-commits] [git/LaTeX3-latex3-latex2e] cmdhook-fixes: Add tests for ltcmdhooks errors (8b033660)

PhelypeOleinik phelype.oleinik at latex-project.org
Wed May 26 06:38:57 CEST 2021


Repository : https://github.com/latex3/latex2e
On branch  : cmdhook-fixes
Link       : https://github.com/latex3/latex2e/commit/8b03366093c87dbf6fc7fe906388ee360acd90b1

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

commit 8b03366093c87dbf6fc7fe906388ee360acd90b1
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date:   Wed May 26 01:38:57 2021 -0300

    Add tests for ltcmdhooks errors


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

8b03366093c87dbf6fc7fe906388ee360acd90b1
 base/testfiles-lthooks/ltcmdhooks-011.lvt | 29 +++++++++++++++++++++++
 base/testfiles-lthooks/ltcmdhooks-011.tlg | 39 +++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+)

diff --git a/base/testfiles-lthooks/ltcmdhooks-011.lvt b/base/testfiles-lthooks/ltcmdhooks-011.lvt
new file mode 100644
index 00000000..2f121573
--- /dev/null
+++ b/base/testfiles-lthooks/ltcmdhooks-011.lvt
@@ -0,0 +1,29 @@
+\RequirePackage[enable-debug,check-declarations]{expl3}
+\ExplSyntaxOn
+\debug_on:n { deprecation }
+\ExplSyntaxOff
+
+\input{regression-test}
+
+\csname __hook_cmd_begindocument_code:\endcsname
+
+\START
+
+% wrong-cmd-hook
+\AddToHook{cmd/textbf/middle}{error}
+
+% cant-patch undef
+\AddToHook{cmd/undefined/before}{error}
+
+% cant-patch macro
+\AddToHook{cmd/detokenize/before}{error}
+
+% cant-patch expl3
+\AddToHook{cmd/__hook_cmd_begindocument_code:/before}{error}
+
+{\catcode`\&=11 \gdef\mycmd#1{test & me}}
+
+% cant-patch retok
+\AddToHook{cmd/mycmd/before}{error}
+
+\END
diff --git a/base/testfiles-lthooks/ltcmdhooks-011.tlg b/base/testfiles-lthooks/ltcmdhooks-011.tlg
new file mode 100644
index 00000000..059368d5
--- /dev/null
+++ b/base/testfiles-lthooks/ltcmdhooks-011.tlg
@@ -0,0 +1,39 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+! LaTeX3 Error: Command hook `cmd/textbf/middle' invalid.
+(LaTeX3)        The hook should be `cmd/textbf/before' or
+(LaTeX3)        `cmd/textbf/after'.
+For immediate help type H <return>.
+ ...                                              
+l. ...\AddToHook{cmd/textbf/middle}{error}
+You tried to add a hook to command \textbf, but `middle' is an invalid
+position. Only `before' or `after' are allowed.
+! LaTeX3 Error: Command `\undefined' cannot have hooks because it doesn't
+(LaTeX3)        exist.
+For immediate help type H <return>.
+ ...                                              
+l. ...\AddToHook{cmd/undefined/before}{error}
+You tried to add a hook to `\undefined', but LaTeX was not able to add the
+hook to that command because `\undefined' doesn't exist.
+! LaTeX3 Error: Command `\detokenize' cannot have hooks because it is not a
+(LaTeX3)        macro.
+For immediate help type H <return>.
+ ...                                              
+l. ...\AddToHook{cmd/detokenize/before}{error}
+You tried to add a hook to `\detokenize', but LaTeX was not able to add the
+hook to that command because `\detokenize' is not a macro.
+! LaTeX3 Error: Command `\__hook_cmd_begindocument_code:' cannot have hooks
+(LaTeX3)        because it doesn't exist.
+For immediate help type H <return>.
+ ...                                              
+l. ......ook_cmd_begindocument_code:/before}{error}
+You tried to add a hook to `\__hook_cmd_begindocument_code:', but LaTeX was
+not able to add the hook to that command because
+`\__hook_cmd_begindocument_code:' doesn't exist.
+! LaTeX3 Error: Command `\mycmd' cannot have hooks because it can't be
+(LaTeX3)        retokenized cleanly.
+For immediate help type H <return>.
+ ...                                              
+l. ...\AddToHook{cmd/mycmd/before}{error}
+You tried to add a hook to `\mycmd', but LaTeX was not able to add the hook to
+that command because `\mycmd' can't be retokenized cleanly.





More information about the latex3-commits mailing list.