Difference between revisions of "Module:Delink/testcases"
Jump to navigation
Jump to search
blackwiki>Mr. Stradivarius (add another) |
blackwiki>Mr. Stradivarius (category/interwiki test cases) |
||
| Line 7: | Line 7: | ||
self:preprocess_equals('{{#invoke:Delink|delink|All [[Gone]] [[wikt:to|]] [[Bed]] [[Now]]}}', 'All Gone to Bed Now') | self:preprocess_equals('{{#invoke:Delink|delink|All [[Gone]] [[wikt:to|]] [[Bed]] [[Now]]}}', 'All Gone to Bed Now') | ||
self:preprocess_equals('{{#invoke:Delink|delink|[[Survey]] of [http://books.google.com Google Books] on [[UK|Britain]]}}', 'Survey of Google Books on Britain') | self:preprocess_equals('{{#invoke:Delink|delink|[[Survey]] of [http://books.google.com Google Books] on [[UK|Britain]]}}', 'Survey of Google Books on Britain') | ||
| + | end | ||
| + | |||
| + | function p:test_cats_and_interwikis() | ||
| + | self:preprocess_equals('{{#invoke:Delink|delink|[[Category:Foo]]}}', '') | ||
| + | self:preprocess_equals('{{#invoke:Delink|delink|[[es:Foo]]}}', '') | ||
| + | self:preprocess_equals('{{#invoke:Delink|delink|[[wikt:Foo]]}}', 'wikt:Foo') | ||
| + | self:preprocess_equals('{{#invoke:Delink|delink|[[es:Wikipedia:Políticas]]}}', '') | ||
| + | self:preprocess_equals('{{#invoke:Delink|delink|[[abcd:efgh:ijkl]]}}', 'abcd:efgh:ijkl') | ||
| + | self:preprocess_equals('{{#invoke:Delink|delink|[[cbk-zam:abcd:efgh]]}}', '') | ||
| + | end | ||
| + | |||
| + | function p:test_colontrick() | ||
| + | self:preprocess_equals('{{#invoke:Delink|delink|[[:Category:Foo]]}}', 'Category:Foo') | ||
| + | self:preprocess_equals('{{#invoke:Delink|delink|[[:es:Foo]]}}', 'es:Foo') | ||
| + | self:preprocess_equals('{{#invoke:Delink|delink|[[:wikt:Foo]]}}', 'wikt:Foo') | ||
| + | self:preprocess_equals('{{#invoke:Delink|delink|[[:es:Wikipedia:Políticas]]}}', 'es:Wikipedia:Políticas') | ||
| + | self:preprocess_equals('{{#invoke:Delink|delink|[[:abcd:efgh:ijkl]]}}', 'abcd:efgh:ijkl') | ||
| + | self:preprocess_equals('{{#invoke:Delink|delink|[[:cbk-zam:abcd:efgh]]}}', 'cbk-zam:abcd:efgh') | ||
end | end | ||
Revision as of 10:12, 3 April 2013
Documentation for this module may be created at Module:Delink/testcases/doc
local p = require('Module:UnitTests')
function p:test_basic()
self:preprocess_equals('{{#invoke:Delink|delink|[[Apple]]}}', 'Apple')
self:preprocess_equals('{{#invoke:Delink|delink|[[Orange]]s are dissimilar to [[Apple]]s}}', 'Oranges are dissimilar to Apples')
self:preprocess_equals('{{#invoke:Delink|delink|[[Apple]]s and [[orange]]s and [[fruit salad|other kinds of fruit]]}}', 'Apples and oranges and other kinds of fruit')
self:preprocess_equals('{{#invoke:Delink|delink|All [[Gone]] [[wikt:to|]] [[Bed]] [[Now]]}}', 'All Gone to Bed Now')
self:preprocess_equals('{{#invoke:Delink|delink|[[Survey]] of [http://books.google.com Google Books] on [[UK|Britain]]}}', 'Survey of Google Books on Britain')
end
function p:test_cats_and_interwikis()
self:preprocess_equals('{{#invoke:Delink|delink|[[Category:Foo]]}}', '')
self:preprocess_equals('{{#invoke:Delink|delink|[[es:Foo]]}}', '')
self:preprocess_equals('{{#invoke:Delink|delink|[[wikt:Foo]]}}', 'wikt:Foo')
self:preprocess_equals('{{#invoke:Delink|delink|[[es:Wikipedia:Políticas]]}}', '')
self:preprocess_equals('{{#invoke:Delink|delink|[[abcd:efgh:ijkl]]}}', 'abcd:efgh:ijkl')
self:preprocess_equals('{{#invoke:Delink|delink|[[cbk-zam:abcd:efgh]]}}', '')
end
function p:test_colontrick()
self:preprocess_equals('{{#invoke:Delink|delink|[[:Category:Foo]]}}', 'Category:Foo')
self:preprocess_equals('{{#invoke:Delink|delink|[[:es:Foo]]}}', 'es:Foo')
self:preprocess_equals('{{#invoke:Delink|delink|[[:wikt:Foo]]}}', 'wikt:Foo')
self:preprocess_equals('{{#invoke:Delink|delink|[[:es:Wikipedia:Políticas]]}}', 'es:Wikipedia:Políticas')
self:preprocess_equals('{{#invoke:Delink|delink|[[:abcd:efgh:ijkl]]}}', 'abcd:efgh:ijkl')
self:preprocess_equals('{{#invoke:Delink|delink|[[:cbk-zam:abcd:efgh]]}}', 'cbk-zam:abcd:efgh')
end
function p:test_pipetrick()
self:preprocess_equals('{{#invoke:Delink|delink|[[Pipe (computing)|]]}}', 'Pipe')
self:preprocess_equals('{{#invoke:Delink|delink|[[Boston, Massachusetts|]]}}', 'Boston')
self:preprocess_equals('{{#invoke:Delink|delink|[[Wikipedia:Verifiability|]]}}', 'Verifiability')
self:preprocess_equals('{{#invoke:Delink|delink|[[User:Example|]]}}', 'Example')
self:preprocess_equals('{{#invoke:Delink|delink|[[Template:Welcome|]]}}', 'Welcome')
self:preprocess_equals('{{#invoke:Delink|delink|[[Yours, Mine and Ours (1968 film)|]]}}', 'Yours, Mine and Ours')
self:preprocess_equals('{{#invoke:Delink|delink|[[:es:Wikipedia:Políticas|]]}}', 'Wikipedia:Políticas')
self:preprocess_equals('{{#invoke:Delink|delink|[[Il Buono, il Brutto, il Cattivo|]]}}', 'Il Buono')
self:preprocess_equals('{{#invoke:Delink|delink|[[Wikipedia:Manual of Style (Persian)|]]}}', 'Manual of Style')
self:preprocess_equals('{{#invoke:Delink|delink|[[Wikipedia:Manual of Style(Persian)|]]}}', 'Manual of Style')
end
return p