Module:Icon/testcases: Difference between revisions

Content deleted Content added
create
 
only make the file link pattern once
Line 4:
local frame = mw.getCurrentFrame()
 
local function icon(args)fileLinkPattern
do
-- return frame:expandTemplate{title = 'icon', args = args}
return mIcon._main(args)
end
 
function suite:assertFileLink(s)
local spaces = '[_ \t]*'
local titleChar = '[^|<>%[%]{}]'
local titleCharOrPipe = '[^<>%[%]{}]'
local patternfileLinkPattern = '^%[%[' .. spaces .. '(.-)' .. spaces .. ':' .. spaces ..
titleChar .. '-' .. titleCharOrPipe .. '-|' .. titleChar .. '-|' ..
spaces .. 'link=' .. spaces .. '%]%]$'
end
local nsText = s:match(pattern)
 
local function icon(args)
-- return frame:expandTemplate{title = 'icon/sandbox', args = args}
-- return mIcon._main(args)
end
 
function suite:assertFileLink(s)
local nsText = s:match(patternfileLinkPattern)
nsText = nsText and nsText:lower()
self:assertTrue(nsText == 'file' or nsText == 'image')