Module:Text/testcases
Appearance
![]() | This is the test cases page for the module Module:Text. Results of the test cases. |
local p = require('Module:UnitTests')
local Text = require('Module:Text').Text()
function p:testGetPlain()
self:equals('plain',Text.getPlain('a and b'),'a and b')
self:equals('comment',Text.getPlain('a<!--comment-->b'),'ab')
self:equals('2 comments',Text.getPlain(' <!--comment-->hello, world<!--comment 2--> '),' hello, world ')
self:equals('wikimarkup',Text.getPlain('a <nowiki>b</nowiki> c'),'a b c')
self:equals('bold',Text.getPlain("'''a'''"),"a")
self:equals('italic',Text.getPlain("''b''"),"b")
self:equals('bold and italic',Text.getPlain("'''a''' and ''b''"),"a and b")
self:equals('nbsp',Text.getPlain("a and b"),"a and b")
self:equals('weird1',Text.getPlain("'''a'' and '''b''"),"a and b")
self:equals('weird2',Text.getPlain("a<!--I am an unclosed comment"),"a")
self:equals('weird3',Text.getPlain("'''unclosed bold"),"unclosed bold")
self:equals('mix1',Text.getPlain("<!-- hello -- -->'''a''' <!--world-->''<nowiki>b</nowiki>''"),"a b")
self:equals('mix2',Text.getPlain("<b>a</b> '''b'''<!-- hello -- world -->, <div style='font-size:100%;'>c</div>"),"a b, c")
end
return p