diff options
author | chai <chaifix@163.com> | 2021-10-30 11:32:16 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-10-30 11:32:16 +0800 |
commit | 42ec7286b2d36a9ba22925f816a17cb1cc2aa5ce (patch) | |
tree | 24bc7009457a8d7500f264e89946dc20d069294f /Data/Libraries/Penlight/tests/lua/mymod.lua | |
parent | 164885fd98d48703bd771f802d79557b7db97431 (diff) |
+ Penlight
Diffstat (limited to 'Data/Libraries/Penlight/tests/lua/mymod.lua')
-rw-r--r-- | Data/Libraries/Penlight/tests/lua/mymod.lua | 19 |
1 files changed, 19 insertions, 0 deletions
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 + |