niceeval/expect 提供一组可组合 matcher,传给 t.check() 或 t.require()。matcher 会返回一个 Assertion,并带有默认严重性:gate 或 soft。
使用方式
| 方法 | 失败时 | 适合 |
|---|---|---|
t.check | 记录结果,继续执行 | 大多数断言 |
t.require | 立即抛出,中断 test | 后续执行没有意义的前置条件 |
Matchers
includes
equals
matches
similarity
satisfies
gate 和 soft
gate():失败会让 eval 失败。soft():参与评分,但不一定让 eval 失败。