Content deleted Content added
sync from main module |
add a new test assertNotStringContains |
||
Line 147:
ScribuntoUnit = true,
text = mw.ustring.format('Failed to find %s "%s" in string "%s"', plain and "plain string" or "pattern", pattern, display),
message = message
}, 2)
end
end
-------------------------------------------------------------------------------
-- Checks an input string doesn't contain the expected string
-- @param message optional description of the test
-- @param plain search is made with a plain string instead of a ustring pattern
--
function ScribuntoUnit:assertNotStringContains(pattern, s, plain, message)
if type(pattern) ~= 'string' then
DebugHelper.raise({
ScribuntoUnit = true,
text = mw.ustring.format("Pattern type error (expected string, got %s)", type(pattern)),
message = message
}, 2)
end
if type(s) ~= 'string' then
DebugHelper.raise({
ScribuntoUnit = true,
text = mw.ustring.format("String type error (expected string, got %s)", type(s)),
message = message
}, 2)
end
local match = mw.ustring.match(s, pattern, nil, plain)
if match then
DebugHelper.raise({
ScribuntoUnit = true,
text = mw.ustring.format('Found match "%s" in the test string for %s "%s"', match, plain and "plain string" or "pattern", pattern),
message = message
}, 2)
|