Skip to content

Commit eaf290d

Browse files
tflanaganrvagg
authored andcommitted
doc: sort assert alphabetically
Reorders, with no contextual changes, the assert documentation alphabetically. PR-URL: #3662 Reviewed-By: Evan Lucas <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
1 parent 5226d1e commit eaf290d

File tree

1 file changed

+54
-54
lines changed

1 file changed

+54
-54
lines changed

doc/api/assert.markdown

+54-54
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,11 @@ This module is used so that Node.js can test itself. It can be accessed with
66
`require('assert')`. However, it is recommended that a userland assertion
77
library be used instead.
88

9-
## assert.fail(actual, expected, message, operator)
10-
11-
Throws an exception that displays the values for `actual` and `expected`
12-
separated by the provided operator.
13-
149
## assert(value[, message]), assert.ok(value[, message])
1510

1611
Tests if value is truthy. It is equivalent to
1712
`assert.equal(!!value, true, message)`.
1813

19-
## assert.equal(actual, expected[, message])
20-
21-
Tests shallow, coercive equality with the equal comparison operator ( `==` ).
22-
23-
## assert.notEqual(actual, expected[, message])
24-
25-
Tests shallow, coercive inequality with the not equal comparison operator
26-
( `!=` ).
27-
2814
## assert.deepEqual(actual, expected[, message])
2915

3016
Tests for deep equality. Primitive values are compared with the equal
@@ -39,27 +25,72 @@ non-enumerable:
3925
// WARNING: This does not throw an AssertionError!
4026
assert.deepEqual(Error('a'), Error('b'));
4127

28+
## assert.deepStrictEqual(actual, expected[, message])
29+
30+
Tests for deep equality. Primitive values are compared with the strict equality
31+
operator ( `===` ).
32+
33+
## assert.doesNotThrow(block[, error][, message])
34+
35+
Expects `block` not to throw an error. See [assert.throws()](#assert_assert_throws_block_error_message) for more details.
36+
37+
If `block` throws an error and if it is of a different type from `error`, the
38+
thrown error will get propagated back to the caller. The following call will
39+
throw the `TypeError`, since we're not matching the error types in the
40+
assertion.
41+
42+
assert.doesNotThrow(
43+
function() {
44+
throw new TypeError("Wrong value");
45+
},
46+
SyntaxError
47+
);
48+
49+
In case `error` matches with the error thrown by `block`, an `AssertionError`
50+
is thrown instead.
51+
52+
assert.doesNotThrow(
53+
function() {
54+
throw new TypeError("Wrong value");
55+
},
56+
TypeError
57+
);
58+
59+
## assert.equal(actual, expected[, message])
60+
61+
Tests shallow, coercive equality with the equal comparison operator ( `==` ).
62+
63+
## assert.fail(actual, expected, message, operator)
64+
65+
Throws an exception that displays the values for `actual` and `expected`
66+
separated by the provided operator.
67+
68+
## assert.ifError(value)
69+
70+
Throws `value` if `value` is truthy. This is useful when testing the `error`
71+
argument in callbacks.
72+
4273
## assert.notDeepEqual(actual, expected[, message])
4374

4475
Tests for any deep inequality. Opposite of `assert.deepEqual`.
4576

46-
## assert.strictEqual(actual, expected[, message])
77+
## assert.notDeepStrictEqual(actual, expected[, message])
4778

48-
Tests strict equality as determined by the strict equality operator ( `===` ).
79+
Tests for deep inequality. Opposite of `assert.deepStrictEqual`.
80+
81+
## assert.notEqual(actual, expected[, message])
82+
83+
Tests shallow, coercive inequality with the not equal comparison operator
84+
( `!=` ).
4985

5086
## assert.notStrictEqual(actual, expected[, message])
5187

5288
Tests strict inequality as determined by the strict not equal operator
5389
( `!==` ).
5490

55-
## assert.deepStrictEqual(actual, expected[, message])
56-
57-
Tests for deep equality. Primitive values are compared with the strict equality
58-
operator ( `===` ).
59-
60-
## assert.notDeepStrictEqual(actual, expected[, message])
91+
## assert.strictEqual(actual, expected[, message])
6192

62-
Tests for deep inequality. Opposite of `assert.deepStrictEqual`.
93+
Tests strict equality as determined by the strict equality operator ( `===` ).
6394

6495
## assert.throws(block[, error][, message])
6596

@@ -97,34 +128,3 @@ Custom error validation:
97128
},
98129
"unexpected error"
99130
);
100-
101-
## assert.doesNotThrow(block[, error][, message])
102-
103-
Expects `block` not to throw an error. See [assert.throws()](#assert_assert_throws_block_error_message) for more details.
104-
105-
If `block` throws an error and if it is of a different type from `error`, the
106-
thrown error will get propagated back to the caller. The following call will
107-
throw the `TypeError`, since we're not matching the error types in the
108-
assertion.
109-
110-
assert.doesNotThrow(
111-
function() {
112-
throw new TypeError("Wrong value");
113-
},
114-
SyntaxError
115-
);
116-
117-
In case `error` matches with the error thrown by `block`, an `AssertionError`
118-
is thrown instead.
119-
120-
assert.doesNotThrow(
121-
function() {
122-
throw new TypeError("Wrong value");
123-
},
124-
TypeError
125-
);
126-
127-
## assert.ifError(value)
128-
129-
Throws `value` if `value` is truthy. This is useful when testing the `error`
130-
argument in callbacks.

0 commit comments

Comments
 (0)