[latex3-commits] [git/LaTeX3-latex3-latex3] master: Tests for hooks (1cbd1dd)

Joseph Wright joseph.wright at morningstar2.co.uk
Fri Jun 7 08:58:05 CEST 2019


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/1cbd1ddcea1a9fe0bbc8de12ddcbee45902653ff

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

commit 1cbd1ddcea1a9fe0bbc8de12ddcbee45902653ff
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Fri Jun 7 07:55:03 2019 +0100

    Tests for hooks


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

1cbd1ddcea1a9fe0bbc8de12ddcbee45902653ff
 l3trial/l3hooks/testfiles/m3hooks001.lvt |   81 +++++++++++++++++++++
 l3trial/l3hooks/testfiles/m3hooks001.tlg |  114 ++++++++++++++++++++++++++++++
 2 files changed, 195 insertions(+)

diff --git a/l3trial/l3hooks/testfiles/m3hooks001.lvt b/l3trial/l3hooks/testfiles/m3hooks001.lvt
new file mode 100644
index 0000000..f74e200
--- /dev/null
+++ b/l3trial/l3hooks/testfiles/m3hooks001.lvt
@@ -0,0 +1,81 @@
+%
+% Copyright (C) 2019 The LaTeX3 Project
+%
+
+\documentclass{minimal}
+\input{regression-test}
+
+% Test the package loads properly.  To avoid having to regenerate the
+% file whenever expl3 is changed, preload it.
+
+\RequirePackage[enable-debug]{expl3}
+\ExplSyntaxOn
+\debug_on:n { check-declarations , deprecation }
+\ExplSyntaxOff
+
+\START
+\AUTHOR{Joseph Wright}
+\RequirePackage{l3hooks}
+
+\ExplSyntaxOn
+
+\TEST { New~hook }
+  {
+    \hook_new:nn { mypkg } { hook-a }
+    \hook_new:nn { mypkg } { hook-b }
+    \hook_document_new:n { dochook }
+  }
+
+\TEST { New~hook~errors }
+  {
+    \hook_new:nn { mypkg } { hook-a }
+    \hook_new:nn { mypkg } { hook-b }
+    \hook_document_new:n { dochook }
+  }
+
+\TEST { Push~to~hook }
+  {
+    \hook_gpush_all:nnnn { mypkg } { hook-a }
+      { otherpkg } { \tl_show:n { otherpkg } }
+    \hook_gpush_next:nnnn { mypkg } { hook-a }
+      { otherpkg } { \tl_show:n { once } }
+    \hook_gpush_all:nnnnn { mypkg } { hook-b }
+      { otherpkg } { sub-a } { \tl_show:n { not~this } }
+    \hook_gpush_all:nnnnn { mypkg } { hook-b }
+      { otherpkg } { sub-a } { \tl_show:n { that } }
+    \hook_gpush_all:nnnnn { mypkg } { hook-b }
+      { otherpkg } { sub-b } { \tl_show:n { the~other } }
+    \hook_document_gpush:nnn { dochook }
+      { otherpkg } { \tl_show:n { dochook } }
+    \hook_document_gpush:nnnn { dochook }
+      { thirdpkg } { a } { \tl_show:n { dochook-a } }
+    \hook_document_gpush:nnnn { dochook }
+      { thirdpkg } { b } { \tl_show:n { dochook-b } }
+  }
+
+\TEST { Push~to~hook~errors }
+  {
+    \hook_gpush_all:nnnn { mypkg } { hook-c }
+      { otherpkg } { \tl_show:n { otherpkg } }
+    \hook_gpush_next:nnnn { mypkg } { hook-c }
+      { otherpkg } { \tl_show:n { once } }
+    \hook_document_gpush:nnn { nothook }
+      { otherpkg } { \tl_show:n { nothook } }
+  }
+
+\TEST { Using~hook }
+  {
+    \hook_use:nn { mypkg } { hook-a }
+    \hook_use:nn { mypkg } { hook-a }
+    \hook_use:nn { mypkg } { hook-b }
+    \hook_use:nn { mypkg } { hook-b }
+    \hook_document_use:n { dochook }
+  }
+
+\TEST { Hook~use~errors }
+  {
+    \hook_use:nn { mypkg } { hook-c }
+    \hook_document_use:n { dochook }
+  }
+
+\END
\ No newline at end of file
diff --git a/l3trial/l3hooks/testfiles/m3hooks001.tlg b/l3trial/l3hooks/testfiles/m3hooks001.tlg
new file mode 100644
index 0000000..6b7b549
--- /dev/null
+++ b/l3trial/l3hooks/testfiles/m3hooks001.tlg
@@ -0,0 +1,114 @@
+This is a generated file for the LaTeX (2e + expl3) validation system.
+Don't change this file in any respect.
+Author: Joseph Wright
+(l3hooks.sty
+Package: l3hooks ....-..-.. L3 Experimental hook management
+)
+============================================================
+TEST 1: New hook
+============================================================
+============================================================
+============================================================
+TEST 2: New hook errors
+============================================================
+! LaTeX3 Error: Hook 'mypkg/hook-a' already defined.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+LaTeX has been asked to create a new hook 'hook-a' for module 'mypkg' but this
+name has already been used elsewhere.
+! LaTeX3 Error: Hook 'mypkg/hook-b' already defined.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+LaTeX has been asked to create a new hook 'hook-b' for module 'mypkg' but this
+name has already been used elsewhere.
+! LaTeX3 Error: Hook 'dochook' already defined.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+LaTeX has been asked to create a new document-wide hook 'dochook' but this
+name has already been used elsewhere.
+============================================================
+============================================================
+TEST 3: Push to hook
+============================================================
+============================================================
+============================================================
+TEST 4: Push to hook errors
+============================================================
+! LaTeX3 Error: Unknown hook 'mypkg/hook-c'.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+LaTeX has been asked insert a hook 'hook-c' for module 'mypkg' but this name
+has not been defined.
+! LaTeX3 Error: Unknown hook 'mypkg/hook-c'.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+LaTeX has been asked insert a hook 'hook-c' for module 'mypkg' but this name
+has not been defined.
+! LaTeX3 Error: Unknown document-wide hook 'nothook'.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+LaTeX has been asked insert a document-wide hook 'nothook' but this name has
+not been defined.
+============================================================
+============================================================
+TEST 5: Using hook
+============================================================
+> otherpkg.
+<recently read> }
+l. ...  }
+> once.
+<recently read> }
+l. ...  }
+> otherpkg.
+<recently read> }
+l. ...  }
+> that.
+<recently read> }
+l. ...  }
+> that.
+<recently read> }
+l. ...  }
+> the other.
+<recently read> }
+l. ...  }
+> that.
+<recently read> }
+l. ...  }
+> that.
+<recently read> }
+l. ...  }
+> the other.
+<recently read> }
+l. ...  }
+> dochook.
+<recently read> }
+l. ...  }
+> dochook-a.
+<recently read> }
+l. ...  }
+> dochook-b.
+<recently read> }
+l. ...  }
+============================================================
+============================================================
+TEST 6: Hook use errors
+============================================================
+! LaTeX3 Error: Unknown hook 'mypkg/hook-c'.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+LaTeX has been asked insert a hook 'hook-c' for module 'mypkg' but this name
+has not been defined.
+! LaTeX3 Error: Document hook 'dochook' has already been used.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+LaTeX has been asked to use document-wide hook 'dochook' but this hook has
+already been used.
+============================================================





More information about the latex3-commits mailing list