Module:ApplyLinkAnnotations/testcases
Appearance
![]() | This is the test cases page for the module Module:ApplyLinkAnnotations. Results of the test cases. |
-- Unit tests for [[Module:{{ROOTPAGENAME}}]]. Click talk page to run tests.
local p = require('Module:UnitTests')
local m = require('Module:Sandbox/N8wilson/ApplyLinkAnnotations')
function p:test_pattern_lines_to_match()
-- Various lines that should match
self:equals('std list item line',m._testline('*[[hello]]'),'* {{Annotated link |hello}}',{nowiki=1})
end
function p:test_same_line()
-- Test passing a link with no line breaks
self:equals('same line',m.replaceLinksInUnorderedList('*[[hello]]'),'*[[hello]]',{nowiki=1})
end
function p:test_one_item_list()
-- Test updating a single un-piped link in a list
local supply = [==[List
*[[hello]]
]==]
local expect = [==[List
* {{Annotated link |hello}}
]==]
self:preprocess_equals('{{#invoke:Sandbox/N8wilson/ApplyLinkAnnotations|bySubstitutionInUnorderedList|'..supply..'}}', expect,{nowiki=1})
end
return p