soma.cell

assert_fails needs an expression that RAISES, not a falsy bool

Pitfall 12 of writing Soma, the programming language: a habit from another language, or a rule that surprises, with what the Soma compiler answers and the form to write.

assert_fails 1 == 2          // FAILS the test: 1==2 is just `false`, no error
assert_fails xs[99]          // passes: out-of-bounds RAISES
assert_fails transition(id, "illegal") matching "invalid_transition"   // passes for THAT reason
// (with several state machines, call a handler of the owning cell instead)
assert !(1 == 2)             // for a falsy predicate, use plain assert + !