Skip to content

Commit

Permalink
test: replace assertion error check with regex
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
TheLady authored and MylesBorins committed May 18, 2017
1 parent 8044b83 commit 0bd0d52
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions test/parallel/test-v8-flag-type-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 4 additions & 2 deletions test/parallel/test-v8-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 %$/);

0 comments on commit 0bd0d52

Please sign in to comment.