Jump to content

Module:Category handler/testcases

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Mr. Stradivarius (talk | contribs) at 11:21, 1 July 2013 (add tests from Template:Category handler/testcases). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
-- Unit tests for [[Module:Category handler]]. Click talk page to run tests.
local p = require('Module:UnitTests')

function p:test_template_testcases_page()
    self:preprocess_equals_preprocess_many('{{#invoke:Category handler|main', '}}', '{{category handler', '}}', {
        {[[]]},
        {[[
| Somecat]]},
        {[[
| Somecat
| page = Somearticle]]},
        {[[
| Somecat
| page = File:Example/test]]},
        {[[
| Somecat
| page = File:Example/test
| nocat = ]]},
        {[[
| Somecat
| page = File:Example/test
| nocat = true]]},
        {[[
| main = Category:Somecat1 Category:Somecat2
| 1 = Category:Somecat3   <!--For help, user and template space-->
| help = 1
| user = 1
| template = 1
| talk =     <!--No categories on talk pages-->
| other = Category:Somecat4   <!--For all other namespaces-->
| nocat = {{{nocat|}}}   <!--So "nocat=true/false" works-->]]},
        {[[
| main = Category:Somecat1 Category:Somecat2
| 3 = Category:Somecat3   <!--For help, user and template space-->
| help = 3
| user = 3
| template = 3
| talk =     <!--No categories on talk pages-->
| other = Category:Somecat4   <!--For all other namespaces-->
| nocat = {{{nocat|}}}   <!--So "nocat=true/false" works-->]]},
        {[[
| main = Category:Somecat1 Category:Somecat2
| 3 = Category:Somecat3   <!--For help, user and template space-->
| help = 3
| user = 3
| template = 3
| talk =     <!--No categories on talk pages-->
| other = Category:Somecat4   <!--For all other namespaces-->
| nocat = {{{nocat|}}}   <!--So "nocat=true/false" works-->
| page = Somearticle]]},
        {[[
| other = Somecat]]},
        {[[
| other = Somecat
| page = User talk:Example/Archive 5]]},
        {[[
| other = Somecat
| page = User talk:Example/Archive 5
| nocat = false]]},
        {[[
| other = Somecat
| categories = no]]},
        {[[
| other = Somecat
| page = User talk:Example/Archive 5
| categories = yes]]},
        {[[
| other = Somecat
| category2 = no]]},
        {[[
| other = Somecat
| category2 = ]]},
        {[[
| other = Somecat
| category2 = ¬]]},
        {[[
| other = Somecat
| category2 = {{{category|¬}}}]]},
        {[[
| other = Somecat
| page = User talk:Example/Archive 5
| category2 = yes]]}
    })
end

return p