forked from avajs/ava
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This makes most of the built-in assertion functions return Boolean values, `true` when the assertion succeeds and `false` when the assertion fails. This is intended to allow a user to emulate the assertion function throwing an exception by allowing control flow to only proceed if the assertion passes, something like: ``` if (t.is(foo, 42)) { // Do some other things that only make sense when `foo` is `42`. } ``` The various "throws" functions are left alone since they already return exception values. `snapshot` is left alone since it doesn't seem to make much sense to make it return a Boolean in this way. `pass` and `fail` are somewhat special since they act more as "flags" that tell the test runner to pass or fail the test and don't actually do any asserting. In their cases, their returned flag values are chosen for use as analogues of `if (true) { ... }` and `if (false) { ... }`. Fixes issue avajs#2455.
- Loading branch information
1 parent
b71f396
commit ca0c975
Showing
3 changed files
with
593 additions
and
448 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.