Address final review nits on the assertions

- Suite.empty(value, name) checks a table has no entries and reports what it
  held, and Suite.throws(fn, message, name) asserts a function errors with the
  given message, so an unrelated error no longer passes as the expected one.
- Scalar comparisons and zero length checks go through eq and empty, and the
  announced messages and print output are compared by content, so a failure
  shows the actual data.
- get_roles() is asserted through sorted names rather than a count.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
bbassie
2026-08-26 10:48:43 +00:00
co-authored by Claude Fable 5
parent 3218351db6
commit 574a0a4b52
6 changed files with 73 additions and 35 deletions
+3 -3
View File
@@ -46,9 +46,9 @@ end)
test(".print() reaches online holders", function(env)
setup(env)
env.reset_log()
check(env.R("Moderator"):print("hello") == 1, "print returns the number of players reached")
check(#env.printed == 1 and env.printed[1].to == "alice", "only online holders are reached")
check(env.R("Jail"):print("hello") == 0, "a role with no online holders reaches nobody")
eq(env.R("Moderator"):print("hello"), 1, "print returns the number of players reached")
eq(env.printed, { { "hello", to = "alice" } }, "only online holders receive the message")
eq(env.R("Jail"):print("hello"), 0, "a role with no online holders reaches nobody")
end)
test(".print() over get_higher_roles() can repeat", function(env)