lunarmodules / luassert

Assertion library for Lua
MIT License
202 stars 77 forks source link

Make assertion chaining more flexible #80

Closed mpeterv closed 9 years ago

mpeterv commented 9 years ago

Resolve chain to an assertion only when it is called. This allows splitting modifiers and assertions containing underscore across keys, e.g. assert.spy(s).was.called.with instead of was.called_with. Also, a modifier can now be used as last key, e.g. assert.equals.Not.

As a side effect of some refactoring it is now possible to return non-boolean values from assertions (any truthy value indicates success); previously non-boolean return values indicated modifiers.