Module:Sandbox/Naypta/Autolink/testcases: Difference between revisions
imported>Naypta m Naypta moved page Module:Autolink/testcases to Module:Sandbox/Naypta/Autolink/testcases without leaving a redirect: Moving into sandbox |
(No difference)
|
Latest revision as of 11:15, 23 June 2020
Documentation for this module may be created at Module:Sandbox/Naypta/Autolink/testcases/doc
-- Unit tests for [[Module:{{ROOTPAGENAME}}]]. Click talk page to run tests.
local p = require('Module:UnitTests')
function p:test_links()
-- Test internal links
self:preprocess_equals_preprocess_many('{{#invoke:Autolink|link|', '|Test link}}', '[[', '|Test link]]', {
{'User:Example'},
{'WP:Example'},
{'Example'},
{'Wikipedia:Example'},
{'Draft talk:Example'},
},{nowiki=1})
-- Test external links
self:preprocess_equals_preprocess_many('{{#invoke:Autolink|link|', '|Test EL}}', '[', ' Test EL]', {
{'https://example.com/'},
{'http://example.org/'},
{'ftp://example.net/'},
{'scp://example.info/'},
},{nowiki=1})
end
return p