[latex3-commits] [git/LaTeX3-latex3-latex2e] callback_rules: Add testfile (bb0f9fbf)

Marcel Fabian Krüger tex at 2krueger.de
Sun Sep 4 14:56:41 CEST 2022


Repository : https://github.com/latex3/latex2e
On branch  : callback_rules
Link       : https://github.com/latex3/latex2e/commit/bb0f9fbf3147fb33649f77b2c0745d46b4dc2ebb

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

commit bb0f9fbf3147fb33649f77b2c0745d46b4dc2ebb
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Sun Sep 4 14:17:19 2022 +0200

    Add testfile


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

bb0f9fbf3147fb33649f77b2c0745d46b4dc2ebb
 base/testfiles/tlb-callbacks-002.luatex.tlg        | 14 +++++++
 base/testfiles/tlb-callbacks-002.lvt               | 48 ++++++++++++++++++++++
 ...ithub-0060.luatex.tlg => tlb-callbacks-002.tlg} |  1 +
 base/testfiles/tlb-ltluatex-001.luatex.tlg         |  2 +-
 4 files changed, 64 insertions(+), 1 deletion(-)

diff --git a/base/testfiles/tlb-callbacks-002.luatex.tlg b/base/testfiles/tlb-callbacks-002.luatex.tlg
new file mode 100644
index 00000000..61d211b6
--- /dev/null
+++ b/base/testfiles/tlb-callbacks-002.luatex.tlg
@@ -0,0 +1,14 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+ LuaTeX Callback ordering test
+Inserting `first' in `testcallback'.
+Inserting `second' in `testcallback'.
+Inserting `third' in `testcallback'.
+Inserting `forth' in `testcallback'.
+Inserting `fifth' in `testcallback'.
+First try: fifth second third forth first
+Second try: fifth third forth second first
+Third try: fifth forth third second first
+Cycle:
+./ltluatex.lua:335: Cycle occured at second -> forth -> third -> second
+Recovered: fifth second forth third first
diff --git a/base/testfiles/tlb-callbacks-002.lvt b/base/testfiles/tlb-callbacks-002.lvt
new file mode 100644
index 00000000..3afe3a47
--- /dev/null
+++ b/base/testfiles/tlb-callbacks-002.lvt
@@ -0,0 +1,48 @@
+\input{test2e}
+\START
+\typeout{^^J LuaTeX Callback ordering test^^J}
+\ifx\directlua\undefined
+\expandafter \END
+\fi
+
+\directlua{
+%
+% current ltluatex user-callbacks
+  luatexbase.create_callback('testcallback', 'data')
+%
+  local call_order
+  local function add_handler(name)
+    luatexbase.add_to_callback('testcallback', function()
+      texio.write('term and log', ' ' .. name)
+    end, name)
+  end
+  local function run(header)
+    texio.write_nl('term and log', header .. ':')
+    luatexbase.call_callback('testcallback')
+  end
+% Add a rule before the handlers
+  luatexbase.declare_callback_rule('testcallback', 'third', 'before', 'first')
+  add_handler'first'
+  add_handler'second'
+  add_handler'third'
+  add_handler'forth'
+  add_handler'fifth'
+  run'First try'
+% And add rules afterwards
+  luatexbase.declare_callback_rule('testcallback', 'third', 'before', 'second')
+  luatexbase.declare_callback_rule('testcallback', 'fifth', 'before', 'forth')
+  luatexbase.declare_callback_rule('testcallback', 'fifth', 'before', 'first')
+  luatexbase.declare_callback_rule('testcallback', 'first', 'after', 'second')
+  run'Second try'
+  luatexbase.declare_callback_rule('testcallback', 'third', 'before', 'forth')
+  luatexbase.declare_callback_rule('testcallback', 'second', 'after', 'third')
+  luatexbase.declare_callback_rule('testcallback', 'third', 'after', 'forth')
+  run'Third try'
+  luatexbase.declare_callback_rule('testcallback', 'second', 'before', 'forth')
+  local _, msg = pcall(run, 'Cycle')
+  texio.write_nl('term and log', msg)
+  luatexbase.declare_callback_rule('testcallback', 'third', 'unrelated', 'second')
+  run'Recovered'
+}
+
+\END
diff --git a/base/testfiles/github-0060.luatex.tlg b/base/testfiles/tlb-callbacks-002.tlg
similarity index 76%
copy from base/testfiles/github-0060.luatex.tlg
copy to base/testfiles/tlb-callbacks-002.tlg
index 1d0c6975..7b020a4c 100644
--- a/base/testfiles/github-0060.luatex.tlg
+++ b/base/testfiles/tlb-callbacks-002.tlg
@@ -1,2 +1,3 @@
 This is a generated file for the LaTeX2e validation system.
 Don't change this file in any respect.
+ LuaTeX Callback ordering test
diff --git a/base/testfiles/tlb-ltluatex-001.luatex.tlg b/base/testfiles/tlb-ltluatex-001.luatex.tlg
index afd437d0..4730d580 100644
--- a/base/testfiles/tlb-ltluatex-001.luatex.tlg
+++ b/base/testfiles/tlb-ltluatex-001.luatex.tlg
@@ -7,7 +7,7 @@ stack traceback:
 ^^I[C]: in function 'error'
 ^^I./ltluatex.lua:110: in upvalue 'module_error'
 ^^I./ltluatex.lua:117: in upvalue 'luatexbase_error'
-^^I./ltluatex.lua:495: in field 'create_callback'
+^^I./ltluatex.lua:530: in field 'create_callback'
 ^^I[\directlua]:1: in main chunk.
 l. ...}
 The lua interpreter ran into a problem, so the





More information about the latex3-commits mailing list.