Jump to content

Module:Suppress categories/testcases

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Mr. Stradivarius (talk | contribs) at 14:51, 5 July 2013 (create). 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:Suppress categories]]. Click talk page to run tests.
local p = require('Module:UnitTests')

function p:test_main()
    self:preprocess_equals_many('{{#invoke:Suppress categories|main|', '}}', {
        {'foo', 'foo'},
        {'foo[[Category:Some category]]', 'foo'},
        {'foo[[Category:Some category]]bar[[Category:Another category]]', 'foobar'},
        {'foo{{{some_parameter|[[Category:Bar]]}}}', 'foo'},
        {'foo[[Category:Bad ca[]tegory link]]', 'foo[[Category:Bad ca[]tegory link]]'},
        {'foo[[:Category:Colon trick]]', 'foo[[:Category:Colon trick]]'},
        {'foo[[Category:Piped link|bar]]', 'foo'},
        {'foo[[Category:Piped link|ba[]r]]', 'foo'},
        {'foo[[non-category link]]', 'foo[[non-category link]]'},
        {'foo[[ Category : Some category with spaces ]]', 'foo'}
    })
end

return p