- 致编者:请牢记我们的域名wiki.mcbe-dev.net!
- 致编者:欢迎加入本Wiki的官方交流QQ群或Discord服务器!
- 基岩版1.19.31现已发布!(了解更多)
- Inner Core现已支持Xbox模组联机!(了解更多)
- 如果您是第一次来到本Wiki,欢迎注册一个账户
- 点击顶部的“编辑”或“编辑源代码”按钮即可编辑当前页面
- 请知悉:在不登录时也可以编辑和新建页面,但是您当前的IP地址会记录在编辑历史中
Module:Int/testcases
来自Minecraft基岩版开发Wiki
1 test failed.
Name | Expected | Actual | |
---|---|---|---|
testRenderIntMessage | 查看$1条一般通知 | 查看$1条常规通知 | |
testRenderIntMessageWithLang |
local p = require('Module:ScribuntoUnit'):new()
local m = require('Module:Int')
local function callWithArgs(msg, lang, args)
local templateArgs = { msg }
if args then
for n, v in ipairs(args) do
templateArgs[n+1] = v
end
end
local frame = (mw.getCurrentFrame()
:newChild{ args = templateArgs }
:newChild{ args = { [1] = msg, lang = lang } })
return m.renderIntMessage(frame)
end
function p:testRenderIntMessage()
self:assertEquals('查看历史', callWithArgs('vector-view-history'))
self:assertEquals('查看历史', callWithArgs('vector-view-history', nil, {'unused', 'data', 2.71}))
self:assertEquals('查看$1条一般通知', callWithArgs('notification-link-text-expand-notice-count'))
self:assertEquals('查看1条一般通知', callWithArgs('notification-link-text-expand-notice-count', nil, {'1'}))
self:assertEquals('查看1条一般通知', callWithArgs('notification-link-text-expand-notice-count', nil, {1}))
end
function p:testRenderIntMessageWithLang()
self:assertEquals('查看历史', callWithArgs('vector-view-history', ''))
self:assertEquals('查看历史', callWithArgs('vector-view-history', 'zh-hans'))
-- Apostrophes are invalid in language codes; they should be ignored rather than throwing an error
self:assertEquals('查看历史', callWithArgs('vector-view-history', '"zh-hant"'))
self:assertEquals('檢視歷史', callWithArgs('vector-view-history', 'zh-hant'))
end
return p