Browse Source

test: replace assertion error check with regex

PR-URL: https://github.com/nodejs/node/pull/12603
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
v6
thelady 8 years ago
committed by James M Snell
parent
commit
bcb1d9c39a
  1. 6
      test/parallel/test-v8-flag-type-check.js
  2. 6
      test/parallel/test-v8-flags.js

6
test/parallel/test-v8-flag-type-check.js

@ -3,5 +3,7 @@ require('../common');
const assert = require('assert');
const v8 = require('v8');
assert.throws(function() { v8.setFlagsFromString(1); }, TypeError);
assert.throws(function() { v8.setFlagsFromString(); }, TypeError);
assert.throws(function() { v8.setFlagsFromString(1); },
/^TypeError: v8 flag must be a string$/);
assert.throws(function() { v8.setFlagsFromString(); },
/^TypeError: v8 flag is required$/);

6
test/parallel/test-v8-flags.js

@ -12,5 +12,7 @@ assert(eval('%_IsSmi(42)'));
assert(vm.runInThisContext('%_IsSmi(43)'));
v8.setFlagsFromString('--noallow_natives_syntax');
assert.throws(function() { eval('%_IsSmi(44)'); }, SyntaxError);
assert.throws(function() { vm.runInThisContext('%_IsSmi(45)'); }, SyntaxError);
assert.throws(function() { eval('%_IsSmi(44)'); },
/^SyntaxError: Unexpected token %$/);
assert.throws(function() { vm.runInThisContext('%_IsSmi(45)'); },
/^SyntaxError: Unexpected token %$/);

Loading…
Cancel
Save