Skip to content

Commit c42eb5d

Browse files
himself65targos
authored andcommitted
test: refactoring test_error testing
PR-URL: #28902 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent c93df0c commit c42eb5d

File tree

1 file changed

+4
-14
lines changed
  • test/js-native-api/test_error

1 file changed

+4
-14
lines changed

test/js-native-api/test_error/test.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,24 +60,14 @@ assert.throws(() => {
6060
test_error.throwTypeError();
6161
}, /^TypeError: type error$/);
6262

63-
function testThrowArbitrary(value) {
64-
assert.throws(
63+
[42, {}, [], Symbol('xyzzy'), true, 'ball', undefined, null, NaN]
64+
.forEach((value) => assert.throws(
6565
() => test_error.throwArbitrary(value),
6666
(err) => {
6767
assert.strictEqual(err, value);
6868
return true;
69-
});
70-
}
71-
72-
testThrowArbitrary(42);
73-
testThrowArbitrary({});
74-
testThrowArbitrary([]);
75-
testThrowArbitrary(Symbol('xyzzy'));
76-
testThrowArbitrary(true);
77-
testThrowArbitrary('ball');
78-
testThrowArbitrary(undefined);
79-
testThrowArbitrary(null);
80-
testThrowArbitrary(NaN);
69+
}
70+
));
8171

8272
common.expectsError(
8373
() => test_error.throwErrorCode(),

0 commit comments

Comments
 (0)