Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
test: update some error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
sethbrenith authored and kfarnung committed Sep 10, 2018
1 parent 67b92b0 commit d1ed27e
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 12 deletions.
1 change: 1 addition & 0 deletions test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ test-benchmark-es : SKIP
test-fs-readdir-stack-overflow : SKIP

# These tests use the v8 module which chakracore does not support
test-benchmark-v8 : SKIP
test-process-exception-capture-should-abort-on-uncaught-setflagsfromstring : SKIP
test-v8-flag-type-check : SKIP
test-v8-stats : SKIP
Expand Down
10 changes: 8 additions & 2 deletions test/parallel/test-whatwg-url-custom-searchparams-append.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ const URLSearchParams = require('url').URLSearchParams;
assert.throws(() => params.set(obj, 'b'), /^Error: toString$/);
assert.throws(() => params.set('a', obj), /^Error: toString$/);
assert.throws(() => params.set(sym, 'b'),
/^TypeError: Cannot convert a Symbol value to a string$/);
common.engineSpecificMessage({
v8: /^TypeError: Cannot convert a Symbol value to a string$/,
chakracore: /^TypeError: No implicit conversion of Symbol to String$/
}));
assert.throws(() => params.set('a', sym),
/^TypeError: Cannot convert a Symbol value to a string$/);
common.engineSpecificMessage({
v8: /^TypeError: Cannot convert a Symbol value to a string$/,
chakracore: /^TypeError: No implicit conversion of Symbol to String$/
}));
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ function makeIterableFunc(array) {
};
const sym = Symbol();
const toStringError = /^Error: toString$/;
const symbolError = /^TypeError: Cannot convert a Symbol value to a string$/;
const symbolError = common.engineSpecificMessage({
v8: /^TypeError: Cannot convert a Symbol value to a string$/,
chakracore: /^TypeError: No implicit conversion of Symbol to String$/
});

assert.throws(() => new URLSearchParams({ a: obj }), toStringError);
assert.throws(() => new URLSearchParams([['a', obj]]), toStringError);
Expand Down
5 changes: 4 additions & 1 deletion test/parallel/test-whatwg-url-custom-searchparams-delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ const { URL, URLSearchParams } = require('url');
const sym = Symbol();
assert.throws(() => params.delete(obj), /^Error: toString$/);
assert.throws(() => params.delete(sym),
/^TypeError: Cannot convert a Symbol value to a string$/);
common.engineSpecificMessage({
v8: /^TypeError: Cannot convert a Symbol value to a string$/,
chakracore: /^TypeError: No implicit conversion of Symbol to String$/
}));
}

// https://github.com/nodejs/node/issues/10480
Expand Down
5 changes: 4 additions & 1 deletion test/parallel/test-whatwg-url-custom-searchparams-get.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@ const URLSearchParams = require('url').URLSearchParams;
const sym = Symbol();
assert.throws(() => params.get(obj), /^Error: toString$/);
assert.throws(() => params.get(sym),
/^TypeError: Cannot convert a Symbol value to a string$/);
common.engineSpecificMessage({
v8: /^TypeError: Cannot convert a Symbol value to a string$/,
chakracore: /^TypeError: No implicit conversion of Symbol to String$/
}));
}
5 changes: 4 additions & 1 deletion test/parallel/test-whatwg-url-custom-searchparams-getall.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@ const URLSearchParams = require('url').URLSearchParams;
const sym = Symbol();
assert.throws(() => params.getAll(obj), /^Error: toString$/);
assert.throws(() => params.getAll(sym),
/^TypeError: Cannot convert a Symbol value to a string$/);
common.engineSpecificMessage({
v8: /^TypeError: Cannot convert a Symbol value to a string$/,
chakracore: /^TypeError: No implicit conversion of Symbol to String$/
}));
}
5 changes: 4 additions & 1 deletion test/parallel/test-whatwg-url-custom-searchparams-has.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@ const URLSearchParams = require('url').URLSearchParams;
const sym = Symbol();
assert.throws(() => params.has(obj), /^Error: toString$/);
assert.throws(() => params.has(sym),
/^TypeError: Cannot convert a Symbol value to a string$/);
common.engineSpecificMessage({
v8: /^TypeError: Cannot convert a Symbol value to a string$/,
chakracore: /^TypeError: No implicit conversion of Symbol to String$/
}));
}
10 changes: 8 additions & 2 deletions test/parallel/test-whatwg-url-custom-searchparams-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ const URLSearchParams = require('url').URLSearchParams;
assert.throws(() => params.append(obj, 'b'), /^Error: toString$/);
assert.throws(() => params.append('a', obj), /^Error: toString$/);
assert.throws(() => params.append(sym, 'b'),
/^TypeError: Cannot convert a Symbol value to a string$/);
common.engineSpecificMessage({
v8: /^TypeError: Cannot convert a Symbol value to a string$/,
chakracore: /^TypeError: No implicit conversion of Symbol to String$/
}));
assert.throws(() => params.append('a', sym),
/^TypeError: Cannot convert a Symbol value to a string$/);
common.engineSpecificMessage({
v8: /^TypeError: Cannot convert a Symbol value to a string$/,
chakracore: /^TypeError: No implicit conversion of Symbol to String$/
}));
}
7 changes: 4 additions & 3 deletions test/parallel/test-whatwg-url-custom-setters.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ const additionalTestCases =
assert.throws(() => url[name] = obj,
/^Error: toString$/,
`url.${name} = { toString() { throw ... } }`);
assert.throws(() => url[name] = sym,
/^TypeError: Cannot convert a Symbol value to a string$/,
`url.${name} = ${String(sym)}`);
assert.throws(() => url[name] = sym, common.engineSpecificMessage({
v8: /^TypeError: Cannot convert a Symbol value to a string$/,
chakracore: /^TypeError: No implicit conversion of Symbol to String$/
}), `url.${name} = ${String(sym)}`);
}
}
}

0 comments on commit d1ed27e

Please sign in to comment.