Module:Template parameter value/testcases
Appearance
![]() | This is the test cases page for the module Module:Template parameter value. Results of the test cases. |
--Go to the talk page to see the results of the tests. See [[Template:Template parameter value/testpage]] for the content used in testing
local p = require('Module:UnitTests')
local TestPage = "Template:Template parameter value/testpage"
local function process(x)
return x--return mw.getCurrentFrame():preprocess(x)
end
function p:test_TemplateEntry()
--Test _id grabbing for the TemplateN series
self:preprocess_equals_sandbox_many('{{#invoke:Template parameter value', 'main', {
{TestPage.."|X13||_id", "1"},
{TestPage.."|X11||_id", "2"},
{TestPage.."|X11|1|_id", "2"},
{TestPage.."|X12||_id", "3"},
{TestPage.."|X11|2|_id", "4"},
{TestPage.."|X11|3|_id", "5"},
{TestPage.."|X11|4|_id", "subtemplate"},
{TestPage.."|X11|4|_id|2", "6"},
{TestPage.."|X11|4|_id|ignore_subtemplates=y", "6"},
}, {nowiki=1})
--Test grabbing for the other tests (NumericalParameters, HeavyNesting)
self:preprocess_equals_sandbox_many('{{#invoke:Template parameter value', 'main', {
{TestPage.."|X21||1", "X"},
{TestPage.."|X21||2", "Y"},
{TestPage.."|X21||3", "Z"},
{TestPage.."|X21||4", "W"},
{TestPage.."|X21||5", ""},
{TestPage.."|X21||6", "P"},
}, {nowiki=1})
self:preprocess_equals_sandbox_many('{{#invoke:Template parameter value', 'main', {
{TestPage.."|X22||1", "2"},
{TestPage.."|X22||1|ignore_subtemplates=y", ""},
{TestPage.."|X22||A1", "Nest1"},
{TestPage.."|X22||A2", process("Nest2{{X20|x=y|1=2|_id=9}} Content")},
{TestPage.."|X22||A3a", process("{{Text|A|4|A4=A5}}")},
{TestPage.."|X22||A3b", process("1{{Text|A|4|A4=A5}}2")},
{TestPage.."|X22||A4|2", "A5"},
{TestPage.."|X22||A4|3", process("[[Help:Example|{{X20|[[Help:Example]]|_id=%10}}]]")},
{TestPage.."|X22||A5", ""},
{TestPage.."|X22||A6", ""},
{TestPage.."|X22||A7", process("{{X22|_id=11}}")},
}, {nowiki=1})
end
return p