Files
Hunter/scripts/Tests/Hints.spec.luau
T

14 lines
536 B
Luau

--!strict
return function(hints: any)
local s = hints.new()
local low = {key = "low", text = "Подсказка", priority = 1, ttl = .4}
local high = {key = "high", text = "Приоритет", priority = 2, ttl = 1, cooldown = 3}
assert(hints.pick(s, {low}, 0) == low)
assert(hints.pick(s, {low}, .25) == low)
assert(hints.pick(s, {high, low}, .5) == high)
assert(hints.pick(s, {low}, .6) == high)
assert(hints.pick(s, {}, 1.5) == nil)
assert(hints.pick(s, {high}, 2) == nil)
assert(hints.pick(s, {high}, 3.5) == high)
end