Module:Namespace detect/testcases: Difference between revisions

Content deleted Content added
add one more
fix bracket
 
(3 intermediate revisions by the same user not shown)
Line 4:
 
function p:test_template_testcases_page()
self:preprocess_equals_preprocess_manypreprocess_equals_many('{{#invoke:Namespace detect/sandbox|main', '}}', '{{namespace detect', '}}', {
{[[
| main = Article text.
| talk = Any talk page text.
| user = User page text.
| other = Other pages text.]], 'Any talk page text.'},
{[[
| main = Article text.
Line 15:
| user = User page text.
| other = Other pages text.
| demospace = ]], 'Any talk page text.'},
{[[
| main = Article text.
Line 21:
| user = User page text.
| other = Other pages text.
| demospace = main]], 'Article text.'},
{[[
| main = Article text.
Line 27:
| user = User page text.
| other = Other pages text.
| demospace = talk]], 'Any talk page text.'},
{[[
| main = Article text.
Line 33:
| user = User page text.
| other = Other pages text.
| demospace = help talk]], 'Other pages text.'},
{[[
| main = Article text.
Line 39:
| user = User page text.
| other = Other pages text.
| page = ]], 'Any talk page text.'},
{[[
| main = Article text.
Line 45:
| user = User page text.
| other = Other pages text.
| page = Example/test]], 'Article text.'},
{[[
| main = Article text.
Line 51:
| user = User page text.
| other = Other pages text.
| page = User:Example/test]], 'User page text.'},
{[[
| main = Article text.
Line 57:
| user = User page text.
| other = Other pages text.
| page = User talk:Example/test]], 'Any talk page text.'},
})
end
 
function p:test_new()
self:preprocess_equals_preprocess_manypreprocess_equals_many('{{#invoke:Namespace detect/sandbox|main', '}}', '{{namespace detect', '}}', {
{[[]], ''},
{[[
| main = Article text.
Line 69:
| user = User page text.
| other = Other pages text.
| page = User talk:Example/test]], ''},
{[[
| main = Article text.
Line 75:
| user = User page text.
| other = Other pages text.
| page = User:Example/test]], 'User page text.'},
{[[
| main = Article text.
Line 81:
| user = User page text.
| other = Other pages text.
| page = User talk:Example/test]], 'Other pages text.'},
{[[
| main = Article text.
Line 87:
| user = User page text.
| other = Other pages text.
| page = User talk:Example/test]], 'talk page text with a delete character here: ""'},
{[[
| main = Article text.
Line 94:
| user = User page text.
| other = Other pages text.
| demospace = Wikipedia ]], 'Wikipedia page text.'},
{[[
| main =
Line 100:
| user = User page text.
| other = Other pages text.
| page = Foo]], ''},
{[[
| main = Article text.
Line 106:
| user =
| other = Other pages text.
| page = User:Example/test]], ''},
{[[
| main = Article text.
Line 113:
| book = Book page text.
| other = Other pages text.
| page = Book:Foo]], 'Book page text.'},
{[[
| main = Article text.
Line 120:
| image = Image page text.
| other = Other pages text.
| page = File:Foo]], 'Image page text.'},
{[[
| main = Article text.
Line 127:
| file = File page text.
| other = Other pages text.
| page = File:Foo]], 'File page text.'},
{[[
| main = Article text.
Line 134:
| image =
| other = Other pages text.
| page = File:Foo]], ''},
{[[
| main = Article text.
Line 141:
| file =
| other = Other pages text.
| page = File:Foo]], ''},
{[[
| main = Article text.
Line 148:
| mediawiki = MediaWiki page text.
| other = Other pages text.
| page = MediaWiki:Foo]], 'MediaWiki page text.'},
{[[
| main = Article text.
Line 155:
| template = Template page text.
| other = Other pages text.
| page = Template:Foo]], 'Template page text.'},
{[[
| main = Article text.
Line 162:
| image = Image page text.
| other = Other pages text.
| page = Help:Foo]], 'Help page text.'},
{[[
| main = Article text.
Line 169:
| category = Category page text.
| other = Other pages text.
| page = Category:Foo]], 'Category page text.'},
{[[
| main = Article text.
Line 176:
| portal = Portal page text.
| other = Other pages text.
| page = Portal:Foo]], 'Portal page text.'},
{[[
| main = Article text.
Line 183:
| nonexistent = Nonexistent namespace page text.
| other = Other pages text.
| page = Nonexistent:Foo]], 'Article text.'},
{[[
| main = Article text.
Line 190:
| nonexistent = Nonexistent namespace page text.
| other = Other pages text.
| demospace = Nonexistent]], 'Other pages text.'},
})
end
 
function p:test_bad_titles()
self:preprocess_equals_preprocess_manypreprocess_equals_many('{{#invoke:Namespace detect/sandbox|main', '}}', '{{namespace detect', '}}', {
{[==[
| main = Article text.
Line 201:
| user = User page text.
| other = Other pages text.
| page = Talk:Square [[brackets]] aren't allowed in page titles]==], 'Other pages text.'},
})
end
 
function p:test_subject_namespaces()
self:preprocess_equals_preprocess_manypreprocess_equals_many('{{#invoke:Namespace detect/sandbox|main', '}}', '{{namespace detect', '}}', {
{[==[
| main = Article text.
Line 212:
| user = User page text.
| other = Other pages text.
| page = Talk:Foo]==], 'Any talk page text.'},
{[==[
| subjectns = yes
Line 219:
| user = User page text.
| other = Other pages text.
| page = Talk:Foo]==], 'Article text.'},
{[==[
| subjectns = no
Line 226:
| user = User page text.
| other = Other pages text.
| page = Talk:Foo]==], 'Any talk page text.'},
{[==[
| subjectns = yes
Line 233:
| user = User page text.
| other = Other pages text.
| page = Wikipedia talk:Foo]==], 'Other pages text.'},
})
end
 
function p:test_multiple_word_namespaces()
self:preprocess_equals_many('{{#invoke:Namespace detect/sandbox|main', '}}', {
{[==[
| main = Article text.
| talk = Any talk page text.
| user = User page text.
| education program = Education Program pages text.
| other = Other pages text.
| page = Education Program:Foo]==], 'Education Program pages text.'},
})
end