- 致编者:请牢记我们的域名wiki.mcbe-dev.net!
- 致编者:欢迎加入本Wiki的官方交流QQ群或Discord服务器!
- 基岩版1.19.31现已发布!(了解更多)
- Inner Core现已支持Xbox模组联机!(了解更多)
- 如果您是第一次来到本Wiki,欢迎注册一个账户
- 点击顶部的“编辑”或“编辑源代码”按钮即可编辑当前页面
- 请知悉:在不登录时也可以编辑和新建页面,但是您当前的IP地址会记录在编辑历史中
Module:No globals/testcases
来自Minecraft基岩版开发Wiki
Production[编辑]
1 test failed.
Name | Expected | Actual | |
---|---|---|---|
test / test1 | Tried to read nil global foo | Missing JsonConfig extension; Cannot load https://commons.wikimedia.org/wiki/Data:I18n/No globals.tab |
Sandbox[编辑]
1 test failed.
Name | Expected | Actual | |
---|---|---|---|
test | Lua error -- package.lua:80: module 'Module:No globals/sandbox' not found |
local p = require('Module:ScribuntoUnit'):new()
-- Allow test runner to use both the Module:XXX itself and Module:XXX/sandbox with the same testcases
function p:module()
return self.frame and self.frame.args and self.frame.args.module or 'No globals'
end
function p:test()
require('Module:' .. p:module())
-- try returning undeclared variable
self:assertThrows(function() return foo end, "Tried to read nil global foo", 'test1')
-- try writing to an undeclared variable
self:assertThrows(function() bar = 0 end, "Tried to write global bar", 'test2')
-- try reading and writing to variable arg -- should be exempt, and cause no errors
local tmp = arg
arg = arg
end
return p