Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Template invocation/testcases
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
-- Unit tests for [[Module:Template invocation]]. Click talk page to run tests. local ScribuntoUnit = require('Module:ScribuntoUnit') local p = ScribuntoUnit:new() local protect = require('Module:Protect') local function nw(o) return mw.text.nowiki(tostring(o)) end local function test(a, expected) local mTemplateInvocation = require('Module:Template invocation') local mTemplateInvocation2 = require('Module:Template invocation/sandbox') local liveRes = protect(mTemplateInvocation.invocation)('foo', a) local sandboxRes = protect(mTemplateInvocation2.invocation)('foo', a) local message = 'Expected ' .. nw(expected) .. '. Got ' p:assertEquals(expected, liveRes, message .. nw(liveRes) .. ' from live module.') p:assertEquals(expected, sandboxRes, message .. nw(sandboxRes) .. ' from sandbox.') end function p:test_hello() local a = {'bar', 'baz', abc = 'def'}; a[6]=666; a[7]=777; a['7']='777s'; a[3]=333; a['4']='444s' return test(a, '{{foo|bar|baz|333|6=666|7=777|4=444s|7=777s|abc=def}}') end function p:test_equals_sign() local a = {'bar', 'baz', '{{=}}'} return test(a, '{{foo|bar|baz|3={{=}}}}') end function p:test_numbered() local a = {} a[1] = 'aaa' a[2] = 'bbb' a[5] = 'eee' return test(a, '{{foo|aaa|bbb|5=eee}}') end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Template invocation/testcases/doc
(
edit
)