Content deleted Content added
|
|
end
function suite: assertFileLinkassertIsFileLink(s) ▼
local fileLinkPattern
self:assertStringContains('^%[%[File:[^%]]+%]%]$', s)
do
local spaces = '[_ \t]*'
local titleChar = '[^|<>%[%]{}]'
local titleCharOrPipe = '[^<>%[%]{}]'
fileLinkPattern = '^%[%[' .. spaces .. '(.-)' .. spaces .. ':' .. spaces ..
titleChar .. '-' .. titleCharOrPipe .. '-|' .. titleChar .. '-|' ..
spaces .. 'link=' .. spaces .. '%]%]$'
end
▲function suite:assertFileLink(s)
local nsText = s:match(fileLinkPattern)
nsText = nsText and nsText:lower()
self:assertTrue(nsText == 'file' or nsText == 'image')
end
function suite:testIsFileLink()
self:assertFileLinkassertIsFileLink(icon{})
self:assertFileLinkassertIsFileLink(icon{'fa'})
self:assertFileLinkassertIsFileLink(icon{'qwertyuiop'})
end
|