Module:Existsmod/testcases

-- local existsmod = require("Dev:Existsmod").module_exists local ScribuntoUnit = require("Module:ScribuntoUnit") local suite = ScribuntoUnit:new

function suite:test_no_prefix self:assertTrue(existsmod("If", true, false)) self:assertFalse(existsmod("!If", true, false)) end

function suite:test_module_prefix self:assertTrue(existsmod("Module:If", true, false)) self:assertFalse(existsmod("Module:!If", true, false)) end

function suite:test_dev_prefix self:assertTrue(existsmod("Dev:If", true, false)) self:assertFalse(existsmod("Dev:!If", true, false)) end

function suite:test_ifexist_parity self:assertSameResult("", "") self:assertSameResult("", "") self:assertSameResult("", "") self:assertSameResult("", "") self:assertSameResult("", "") self:assertSameResult("", "") self:assertSameResult("", "") self:assertSameResult("", "") self:assertSameResult("", "") self:assertSameResult("", "") self:assertSameResult("", "") self:assertSameResult("", "") end

function suite:test_path_normalization self:assertTrue(existsmod("if", true, false)) self:assertFalse(existsmod("iF", true, false)) self:assertTrue(existsmod("If", true, false))

self:assertTrue(existsmod("module:if", true, false)) self:assertFalse(existsmod("module:iF", true, false)) self:assertTrue(existsmod("module:If", true, false)) self:assertTrue(existsmod("modulE:if", true, false)) self:assertTrue(existsmod("Module:if", true, false))

self:assertTrue(existsmod("dev:if", true, false)) self:assertFalse(existsmod("dev:iF", true, false)) self:assertTrue(existsmod("dev:If", true, false)) self:assertTrue(existsmod("deV:if", true, false)) self:assertTrue(existsmod("Dev:if", true, false)) end

function suite:test_spaces_in_name self:assertTrue(existsmod("User error", true, false)) end

function suite:test_module_is_redirect self:assertTrue(existsmod("Existsmod/redirect test", true, false)) end

function suite:test_module_is_subpage self:assertTrue(existsmod("Sandbox/DarthKitty", true, false)) end

return suite