-- Example unit test.
function p:test_link()
for page_, link_valuev in ipairs(test_link_cases) do
local page, link_value = v[1], v[2]
self:preprocess_equals('{{#invoke:Vital article|link|page=' .. page .. '}}', link_value)
end
self:preprocess_equals(
'{{#invoke:Vital article|link|page=Philosophy}}',
'[[Philosophy]] [[File:Círculos Concéntricos.svg|11px]] [[Wikipedia:Vital articles/Level/1#Level 1 vital articles (10 articles)|1]]')
self:preprocess_equals(
'{{#invoke:Vital article|link|page=philosophy}}',
'[[philosophy]]')
self:preprocess_equals(
'{{#invoke:Vital article|link|page=Calamotropha punctivenellus}}',
'[[Calamotropha punctivenellus]]')
end
function p:test_sandboxtest_link_sandbox()
for _, v in ipairs(test_link_cases) do
self:preprocess_equals(
local page, link_value = v[1], v[2]
'{{#invoke:Vital article|link|page=Philosophy}}',
self:preprocess_equals('{{#invoke:Vital article/sandbox|link|page=Philosophy' .. page .. '}}', link_value)
end
self:preprocess_equals(
'{{#invoke:Vital article|link|page=philosophy}}',
'{{#invoke:Vital article/sandbox|link|page=philosophy}}')
self:preprocess_equals(
'{{#invoke:Vital article|link|page=Calamotropha punctivenellus}}',
'{{#invoke:Vital article/sandbox|link|page=Calamotropha punctivenellus}}')
end
|