Difference between revisions of "Module:Delink/testcases"
Jump to navigation
Jump to search
blackwiki>Mr. Stradivarius (put test cases in tables) |
blackwiki>Mr. Stradivarius m (Undid revision 548428345 by Mr. Stradivarius (talk) that's not right) |
||
| Line 8: | Line 8: | ||
function p:test_all() | function p:test_all() | ||
| − | test('Single simple wikilink', ' | + | test('Single simple wikilink', '[[Apple]]', 'Apple') |
| − | test('text containing wikilinks only', ' | + | test('text containing wikilinks only', '[[Orange]]s are dissimilar to [[Apple]]s', 'Oranges are dissimilar to Apples') |
| − | test('wiktionary with pipe trick',' | + | test('wiktionary with pipe trick',' All [[Gone]] [[wikt:to|]] [[Bed]] [[Now]]', 'All Gone to Bed Now') |
| − | test('external link', ' | + | test('external link', '[[Survey]] of [http://books.google.com Google Books] on [[UK|Britain]]', 'Survey of Google Books on Britain') |
end | end | ||
return p | return p | ||
Revision as of 03:39, 3 April 2013
Documentation for this module may be created at Module:Delink/testcases/doc
local p = require('Module:UnitTests')
local D = require('Module:User:Mr. Stradivarius/sandbox2')
local function test(name, text_in, expected)
p:equals_deep(name, D.delink(text_in), expected, {nowiki = true})
end
function p:test_all()
test('Single simple wikilink', '[[Apple]]', 'Apple')
test('text containing wikilinks only', '[[Orange]]s are dissimilar to [[Apple]]s', 'Oranges are dissimilar to Apples')
test('wiktionary with pipe trick',' All [[Gone]] [[wikt:to|]] [[Bed]] [[Now]]', 'All Gone to Bed Now')
test('external link', '[[Survey]] of [http://books.google.com Google Books] on [[UK|Britain]]', 'Survey of Google Books on Britain')
end
return p