Minetest-WorldEditAdditions/worldeditadditions_commands/commands/test/tests/notify_suppress.test.lua

20 lines
706 B
Lua
Raw Normal View History

2024-10-17 15:51:18 +00:00
local Notify = worldeditadditions_core.notify
worldeditadditions.normalize_test("suppress", {
params = "N/A",
description = "Tests notification suppression system.",
func = function(name, params_table)
Notify.suppress_for_player(name, 5)
Notify.warn(name, "This message should not be shown.")
Notify.suppress_for_player(name, -1)
Notify.ok(name, "This message should be shown.")
local result = Notify.suppress_for_function(name, function()
Notify.error(name, "This message should not be shown.")
return true
end)
if not result then
2024-10-17 18:12:53 +00:00
return false, "Error: suppress_for_function did not call function."
2024-10-17 15:51:18 +00:00
else
2024-10-17 18:12:53 +00:00
return true, "suppress_for_function called function."
2024-10-17 15:51:18 +00:00
end
end
})