From 42ec7286b2d36a9ba22925f816a17cb1cc2aa5ce Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 30 Oct 2021 11:32:16 +0800 Subject: + Penlight --- Data/Libraries/Penlight/tests/lua/mymod.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Data/Libraries/Penlight/tests/lua/mymod.lua (limited to 'Data/Libraries/Penlight/tests/lua/mymod.lua') diff --git a/Data/Libraries/Penlight/tests/lua/mymod.lua b/Data/Libraries/Penlight/tests/lua/mymod.lua new file mode 100644 index 0000000..e7d73a7 --- /dev/null +++ b/Data/Libraries/Penlight/tests/lua/mymod.lua @@ -0,0 +1,19 @@ +local strict = require 'pl.strict' +local test = require 'pl.test' +local M = strict.module (...) + +function M.answer () + Boo = false -- fine, it's a declared global + -- in strict mode, you cannot assign to globals if you aren't in main + test.assertraise(function() + Foo = true + end," assign to undeclared global 'Foo'") + return 42 +end + +function M.question () + return 'what is the answer to Life, the Universe and Everything?' +end + +return M + -- cgit v1.1-26-g67d0