[latex3-commits] [git/LaTeX3-latex3-latex2e] cmdhook-fixes: Add more tests for lthooks errors (f24742e3)

PhelypeOleinik phelype.oleinik at latex-project.org
Wed May 26 07:05:16 CEST 2021


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

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

commit f24742e3e87207e18a8ee513350edb2cd4aba605
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date:   Wed May 26 02:05:16 2021 -0300

    Add more tests for lthooks errors


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

f24742e3e87207e18a8ee513350edb2cd4aba605
 base/testfiles-lthooks/lthooks-errors.lvt | 37 ++++++++++++++++++++----
 base/testfiles-lthooks/lthooks-errors.tlg | 48 +++++++++++++++++++++++++++++++
 2 files changed, 80 insertions(+), 5 deletions(-)

diff --git a/base/testfiles-lthooks/lthooks-errors.lvt b/base/testfiles-lthooks/lthooks-errors.lvt
index d8ee750e..90c44be1 100644
--- a/base/testfiles-lthooks/lthooks-errors.lvt
+++ b/base/testfiles-lthooks/lthooks-errors.lvt
@@ -12,17 +12,43 @@
 
 \NewHook{xxx}
 
+% exists
+\NewHook{xxx}
+
+% provide-error
+\ProvideReversedHook{xxx}
+
+\NewReversedHook{yyy}
+
+% provide-error
+\ProvideHook{yyy}
+\DisableHook{yyy}
+
+% provide-disabled
+\ProvideHook{yyy}
+
+% hook-disabled
+\AddToHook{yyy}{error}
+
+% empty-label
+\AddToHook{yyy}[]{error}
+
+% no-default-label
+\PushDefaultHookLabel{}
+
 \AddToHook{xxx}[label1]{ foo1}
 \AddToHook{xxx}[label2]{ foo2}
 \AddToHook{xxx}[label3]{ foo2}
 \AddToHook{xxx}[label4]{ foo3}
 \AddToHook{xxx}[label5]{ foo5}
 
-
+% unknown-rule
 \DeclareHookRule {xxx} {label1} {unknown} {label2}
 
+% labels-incompatible warning
 \DeclareHookRule {xxx} {label3} {incompatible-warning} {label4}
 
+% labels-incompatible error
 \DeclareHookRule {xxx} {label1} {incompatible-error} {label5}
 
 \LogHook{xxx}
@@ -30,21 +56,22 @@
 \makeatletter
 \@expl@@@filehook at file@pop@@
 
-% errors
+% set-top-level
 \SetDefaultHookLabel{my-document}
 
-%
 \AddToHook{begindocument}[top-level]{\TIMO\typeout{allowed}\OMIT}
 \PushDefaultHookLabel{my-document}
   % top-level not allowed with other labels
+  % misused-top-level
   \AddToHook{begindocument}[top-level]{not allowed}
+  % set-top-level
   \SetDefaultHookLabel{top-level}
 \PopDefaultHookLabel
 
-% extra \PopDefaultHookLabel error
+% extra-pop-label
 \PopDefaultHookLabel
 
-% missing \PopDefaultHookLabel error
+% missing-pop-label
 \PushDefaultHookLabel{error}
 \PushDefaultHookLabel{should}
 \PushDefaultHookLabel{this}
diff --git a/base/testfiles-lthooks/lthooks-errors.tlg b/base/testfiles-lthooks/lthooks-errors.tlg
index 43adf6a0..5abd7ead 100644
--- a/base/testfiles-lthooks/lthooks-errors.tlg
+++ b/base/testfiles-lthooks/lthooks-errors.tlg
@@ -1,5 +1,53 @@
 This is a generated file for the l3build validation system.
 Don't change this file in any respect.
+! LaTeX3 Error: Hook 'xxx' has already been declared.
+For immediate help type H <return>.
+ ...                                              
+l. ...\NewHook{xxx}
+There already exists a hook declaration with this name.
+Please use a different name for your hook.
+! LaTeX3 Error: Hook 'xxx' already declared as a normal hook!
+For immediate help type H <return>.
+ ...                                              
+l. ...\ProvideReversedHook{xxx}
+You attempted to provide the hook 'xxx' as a reversed hook, but it was already
+previously declared as a normal hook. A redeclaration is not possible.
+! LaTeX3 Error: Hook 'yyy' already declared as a reversed hook!
+For immediate help type H <return>.
+ ...                                              
+l. ...\ProvideHook{yyy}
+You attempted to provide the hook 'yyy' as a normal hook, but it was already
+previously declared as a reversed hook. A redeclaration is not possible.
+LaTeX3 Warning: Can't provide hook 'yyy' because it is disabled!
+! LaTeX3 Error: Cannot add code to disabled hook 'yyy'.
+For immediate help type H <return>.
+ ...                                              
+l. ...\AddToHook{yyy}{error}
+The hook 'yyy' you tried to add code to was previously disabled with
+\hook_disable:n or \DisableHook, so it cannot have code added to it.
+! Undefined control sequence.
+<argument> \LaTeX3 error: 
+                           Empty code label on line .... Using 'top-level' in...
+l. ...\AddToHook{yyy}[]{error}
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! LaTeX3 Error: Cannot add code to disabled hook 'yyy'.
+For immediate help type H <return>.
+ ...                                              
+l. ...\AddToHook{yyy}[]{error}
+The hook 'yyy' you tried to add code to was previously disabled with
+\hook_disable:n or \DisableHook, so it cannot have code added to it.
+! LaTeX3 Error: Missing (empty) default label on line ....
+(LaTeX3)        This command was ignored.
+Type <return> to continue.
+ ...                                              
+l. ...\PushDefaultHookLabel{}
+LaTeX does not know anything more about this error, sorry.
+Try typing <return> to proceed.
+If that doesn't work, type X <return> to quit.
 ! LaTeX3 Error: Unknown relationship 'unknown' between labels 'label1' and
 (LaTeX3)        'label2'  in hook 'xxx'. Perhaps a missspelling?
 For immediate help type H <return>.





More information about the latex3-commits mailing list.