Module:Template invocation/testcases: Difference between revisions
Appearance
Content deleted Content added
m fix |
m fix 2 |
||
Line 3: | Line 3: | ||
local protect = require('Module:Protect') |
local protect = require('Module:Protect') |
||
function |
local function test(a) |
||
local mTemplateInvocation = require('Module:Template invocation') |
local mTemplateInvocation = require('Module:Template invocation') |
||
local mTemplateInvocation2 = require('Module:Template invocation/sandbox') |
local mTemplateInvocation2 = require('Module:Template invocation/sandbox') |
||
Line 11: | Line 11: | ||
function p:test_hello() |
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' |
local a = {'bar', 'baz', abc = 'def'}; a[6]=666; a[7]=777; a['7']='777s'; a[3]=333; a['4']='444s' |
||
return |
return test(a) |
||
end |
end |
||
function p:test_equals_sign() |
function p:test_equals_sign() |
||
local a = {'bar', 'baz', '{{=}}'} |
local a = {'bar', 'baz', '{{=}}'} |
||
return |
return test(a) |
||
end |
end |
||
Line 24: | Line 24: | ||
a[2] = 'bbb' |
a[2] = 'bbb' |
||
a[5] = 'eee' |
a[5] = 'eee' |
||
return |
return test(a) |
||
end |
end |
||
Revision as of 09:26, 23 May 2020
![]() | This is the test cases page for the module Module:Template invocation. Results of the test cases. |
-- Unit tests for [[Module:Template invocation]]. Click talk page to run tests.
local p = require('Module:UnitTests')
local protect = require('Module:Protect')
local function test(a)
local mTemplateInvocation = require('Module:Template invocation')
local mTemplateInvocation2 = require('Module:Template invocation/sandbox')
return protect(mTemplateInvocation.invocation)('foo', a) .. protect(mTemplateInvocation2.invocation)('foo', a)
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)
end
function p:test_equals_sign()
local a = {'bar', 'baz', '{{=}}'}
return test(a)
end
function p:test_numbered()
local a = {}
a[1] = 'aaa'
a[2] = 'bbb'
a[5] = 'eee'
return test(a)
end
return p