Module:Page/testcases
Appearance
![]() | This is the test cases page for the module Module:Page. Results of the test cases. |
-- Unit tests for [[Module:Page]]. Click talk page to run tests.
local p = require('Module:UnitTests')
function p:test_main()
self:preprocess_equals('{{#invoke:Page|id}}', '38871376')
self:preprocess_equals('{{#invoke:Page|id|}}', '38871376')
self:preprocess_equals('{{#invoke:Page|id|WP:AFC}}', '3376456')
self:preprocess_equals_preprocess('{{#invoke:Page|id|[}}', '{{Error|Error: mw.title.new("[", "") failed}}')
self:preprocess_equals('{{#invoke:Page|id|makeTitle=yes|namespace=WP|AFC}}', '3376456')
self:preprocess_equals_preprocess('{{#invoke:Page|id|makeTitle=yes|namespace=Nonsense|AFC}}', "{{Error|Error: bad argument #1 to 'makeTitle' (unrecognized namespace name 'Nonsense')}}")
self:preprocess_equals('{{#invoke:Page|prefixedText|id=3376456}}', 'Wikipedia:AFC')
self:preprocess_equals_preprocess('{{#invoke:Page|inNamespace|p1=Nonsense|WP:AFC}}', "{{Error|Error: bad argument #1 to 'inNamespace' (unrecognized namespace name 'Nonsense')}}")
self:preprocess_equals('{{#invoke:Page|interwiki|WP:AFC}}', '')
self:preprocess_equals('{{#invoke:Page|namespace|WP:AFC}}', '4')
self:preprocess_equals('{{#invoke:Page|fragment|WP:AFC}}', '')
self:preprocess_equals('{{#invoke:Page|nsText|WP:AFC}}', 'Wikipedia')
self:preprocess_equals('{{#invoke:Page|subjectNsText|WP:AFC}}', 'Wikipedia')
self:preprocess_equals('{{#invoke:Page|text|WP:AFC}}', 'AFC')
self:preprocess_equals('{{#invoke:Page|prefixedText|WP:AFC}}', 'Wikipedia:AFC')
self:preprocess_equals('{{#invoke:Page|fullText|WP:AFC}}', 'Wikipedia:AFC')
self:preprocess_equals('{{#invoke:Page|rootText|WP:AFC}}', 'AFC')
self:preprocess_equals('{{#invoke:Page|baseText|WP:AFC}}', 'AFC')
self:preprocess_equals('{{#invoke:Page|subpageText|WP:AFC}}', 'AFC')
self:preprocess_equals('{{#invoke:Page|canTalk|WP:AFC}}', 'true')
self:preprocess_equals('{{#invoke:Page|exists|WP:AFC}}', 'true')
self:preprocess_equals('{{#invoke:Page|fileExists|WP:AFC}}', '')
self:preprocess_equals('{{#invoke:Page|isContentPage|WP:AFC}}', '')
self:preprocess_equals('{{#invoke:Page|nsText|id=3376456}}', 'Wikipedia')
self:preprocess_equals('{{#invoke:Page|getContent|WP:AFC}}', '<pre>#REDIRECT [[Wikipedia:Articles for creation]]\n\n{{Redirect category shell|\n{{R to Wikipedia namespace}}\n{{R from shortcut}}\n}}</pre>')
self:preprocess_equals('{{#invoke:Page|getContent|WP:AFC|as=pre}}', '<pre>#REDIRECT [[Wikipedia:Articles for creation]]\n\n{{Redirect category shell|\n{{R to Wikipedia namespace}}\n{{R from shortcut}}\n}}</pre>')
self:preprocess_equals('{{#invoke:Page|getContent|WP:AFC|as=nowiki}}', '#REDIRECT [[Wikipedia:Articles for creation]]\n {{Redirect category shell|\n{{R to Wikipedia namespace}}\n{{R from shortcut}}\n}}')
self:preprocess_equals_preprocess('{{#invoke:Page|getContent|WP:AFC|as=expand}}', '\n#REDIRECT [[Wikipedia:Articles for creation]]\n\n{{Redirect category shell|\n{{R to Wikipedia namespace}}\n{{R from shortcut}}\n}}')
end
return p