lune/tests/stdio/style.luau

17 lines
462 B
Text
Raw Normal View History

local stdio = require("@lune/stdio")
2023-02-06 05:13:12 +00:00
local STYLES_VALID = { "reset", "bold", "dim" }
local STYLES_INVALID = { "", "*bold*", "dimm", "megabright", "cheerful", "sad", " " }
for _, style in STYLES_VALID do
stdio.style(style :: any)
stdio.style("reset")
end
for _, style in STYLES_INVALID do
if pcall(stdio.style, style :: any) then
stdio.style("reset")
error(string.format("Setting style should have failed for style '%s' but succeeded", style))
end
end