Module:User:Erutuon/patterns/testcases

Hello, you have come here looking for the meaning of the word Module:User:Erutuon/patterns/testcases. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:User:Erutuon/patterns/testcases, but we will also tell you about its etymology, its characteristics and you will know how to say Module:User:Erutuon/patterns/testcases in singular and plural. Everything you need to know about the word Module:User:Erutuon/patterns/testcases you have here. The definition of the word Module:User:Erutuon/patterns/testcases will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:User:Erutuon/patterns/testcases, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

All tests passed. (refresh)

TextExpectedActual
test canUseString:
Passed"(%=%=+)(+)%=%=+"🗸true🗸true
Passed"αειου"🗸true🗸true
Passed""🗴false🗴false
Passed"%"🗴false🗴false
Passed"%"🗸true🗸true
Passed""🗴false🗴false
Passed"a?"🗸true🗸true
Passed"α?"🗴false🗴false
Passed"a*"🗸true🗸true
Passed"α*"🗴false🗴false
Passed"a-"🗸true🗸true
Passed"α-"🗴false🗴false
Passed"a+"🗸true🗸true
Passed"α+"🗴false🗴false
Passed"a.b"🗴false🗴false

local tests = require("Module:UnitTests")

local canUseString = require("Module:User:Erutuon/patterns").canUseString

local highlight = require("Module:debug").highlight

highlight = highlight{ inline = true }
local function LuaString(text)
	return highlight('"' .. text .. '"')
end

local function displayBoolean(text)
	local color, emoji
	if text == "false" then
		color = "red"
		emoji = "🗴"
	elseif text == "true" then
		color = "green"
		emoji = "🗸"
	end
	return emoji .. '<code><span style="color: ' .. (color or '') .. ';">' .. text .. '</span></code>'
end

local options = { display = displayBoolean }
function tests:check(example, expected)
	self:equals(LuaString(example), canUseString(example), expected, options)
end

tests = function (self)
	local examples = {
		{ "(%=%=+)(+)%=%=+", true }, -- section heading
		{ "αειου", true },
		{ "", false }, -- Greek lowercase vowel letter
		{ "%", false },
		{ "%", true },
		{ "", false }, -- needs an actual example
		{ "a?", true },
		{ "α?", false },
		{ "a*", true },
		{ "α*", false },
		{ "a-", true },
		{ "α-", false },
		{ "a+", true },
		{ "α+", false },
		{ "a.b", false },
	}
	self:iterate(examples, "check")
end

return tests