Jump to content

Module:Redirect/testcases

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Jackmcbarn (talk | contribs) at 12:26, 16 May 2014 (catch regression of a previously fixed bug). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
-- Unit tests for [[Module:Redirect]]. (not the sandbox)  Click talk page to run tests.
local p = require('Module:UnitTests')
 
function p:test_main()
    self:preprocess_equals('{{#invoke:Redirect|main|WP:AFC}}', 'Wikipedia:Articles for creation')
    self:preprocess_equals('{{#invoke:Redirect|main|  WP:AFC  }}', 'Wikipedia:Articles for creation')
    self:preprocess_equals('{{#invoke:Redirect|main|    }}', '')
    self:preprocess_equals('{{#invoke:Redirect|main|[[WP:AFC]]|bracket=yes}}','[[Wikipedia:Articles for creation]]')
    self:preprocess_equals('{{#invoke:Redirect|main|[[WP:AFC]]}}', 'Wikipedia:Articles for creation')
    self:preprocess_equals('{{#invoke:Redirect|main|  [[WP:AFC]]  }}', 'Wikipedia:Articles for creation')
    self:preprocess_equals('{{#invoke:Redirect|main|WP:AFC|bracket=yes}}', '[[Wikipedia:Articles for creation]]')
    self:preprocess_equals('{{#invoke:Redirect|main|  WP:AFC  |bracket=yes}}', '[[Wikipedia:Articles for creation]]')
    self:preprocess_equals('{{#invoke:Redirect|main|User:John Vandenberg/testcases/Redirect/1}}', 'User:John Vandenberg/testcases/Redirect/1')--isRedirect fails
    self:preprocess_equals('{{#invoke:Redirect|main|User:John Vandenberg/testcases/Redirect/2}}', 'Blah')
    self:preprocess_equals('{{#invoke:Redirect|main|mother's Day}}', 'Mother\'s Day') -- not a redirect, but should be canonicalized anyway
end
return p