Skip to content

Commit

Permalink
doc: add examples at assert.strictEqual
Browse files Browse the repository at this point in the history
PR-URL: #28092
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
himself65 authored and Trott committed Jul 18, 2019
1 parent 7e977d7 commit 3ad8799
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions doc/api/assert.md
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,14 @@ assert.strictEqual('Hello foobar', 'Hello World!');
// + 'Hello foobar'
// - 'Hello World!'
// ^

const apples = 1;
const oranges = 2;
assert.strictEqual(apples, oranges, `apples ${apples} !== oranges ${oranges}`);
// AssertionError [ERR_ASSERTION]: apples 1 !== oranges 2

assert.strictEqual(1, '1', new TypeError('Inputs are not identical'));
// TypeError: Inputs are not identical
```

If the values are not strictly equal, an `AssertionError` is thrown with a
Expand Down

0 comments on commit 3ad8799

Please sign in to comment.