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

Commit

Permalink
test: update Symbol error message
Browse files Browse the repository at this point in the history
  • Loading branch information
kfarnung committed Jul 11, 2018
1 parent b245308 commit c3285df
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 22 deletions.
6 changes: 2 additions & 4 deletions test/parallel/test-whatwg-url-searchparams-append.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,16 @@ test(function() {
valueOf() { throw new Error('valueOf'); }
};
const sym = Symbol();
const chakracoreSymbolErrorRegex =
/^TypeError: Object doesn't support property or method 'ToString'/;
assert.throws(() => params.set(obj, 'b'), /^Error: toString$/);
assert.throws(() => params.set('a', obj), /^Error: toString$/);
assert.throws(() => params.set(sym, 'b'),
common.engineSpecificMessage({
v8: /^TypeError: Cannot convert a Symbol value to a string$/,
chakracore: chakracoreSymbolErrorRegex
chakracore: /^TypeError: No implicit conversion of Symbol to String/
}));
assert.throws(() => params.set('a', sym),
common.engineSpecificMessage({
v8: /^TypeError: Cannot convert a Symbol value to a string$/,
chakracore: chakracoreSymbolErrorRegex
chakracore: /^TypeError: No implicit conversion of Symbol to String/
}));
}
2 changes: 1 addition & 1 deletion test/parallel/test-whatwg-url-searchparams-constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ function makeIterableFunc(array) {
const toStringError = /^Error: toString$/;
const symbolError = /^TypeError: Cannot convert a Symbol value to a string$/;
const chakracoreSymbolErrorRegex =
/^TypeError: Object doesn't support property or method 'ToString'/;
/^TypeError: No implicit conversion of Symbol to String/;
assert.throws(() => new URLSearchParams({ a: obj }), toStringError);
assert.throws(() => new URLSearchParams([['a', obj]]), toStringError);
assert.throws(() => new URLSearchParams(sym),
Expand Down
4 changes: 1 addition & 3 deletions test/parallel/test-whatwg-url-searchparams-delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,11 @@ test(function() {
valueOf() { throw new Error('valueOf'); }
};
const sym = Symbol();
const chakracoreSymbolErrorRegex =
/^TypeError: Object doesn't support property or method 'ToString'/;
assert.throws(() => params.delete(obj), /^Error: toString$/);
assert.throws(() => params.delete(sym),
common.engineSpecificMessage({
v8: /^TypeError: Cannot convert a Symbol value to a string$/,
chakracore: chakracoreSymbolErrorRegex
chakracore: /^TypeError: No implicit conversion of Symbol to String/
}));
}

Expand Down
4 changes: 1 addition & 3 deletions test/parallel/test-whatwg-url-searchparams-get.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,10 @@ test(function() {
valueOf() { throw new Error('valueOf'); }
};
const sym = Symbol();
const chakracoreSymbolErrorRegex =
/^TypeError: Object doesn't support property or method 'ToString'/;
assert.throws(() => params.get(obj), /^Error: toString$/);
assert.throws(() => params.get(sym),
common.engineSpecificMessage({
v8: /^TypeError: Cannot convert a Symbol value to a string$/,
chakracore: chakracoreSymbolErrorRegex
chakracore: /^TypeError: No implicit conversion of Symbol to String/
}));
}
4 changes: 1 addition & 3 deletions test/parallel/test-whatwg-url-searchparams-getall.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,10 @@ test(function() {
valueOf() { throw new Error('valueOf'); }
};
const sym = Symbol();
const chakracoreSymbolErrorRegex =
/^TypeError: Object doesn't support property or method 'ToString'/;
assert.throws(() => params.getAll(obj), /^Error: toString$/);
assert.throws(() => params.getAll(sym),
common.engineSpecificMessage({
v8: /^TypeError: Cannot convert a Symbol value to a string$/,
chakracore: chakracoreSymbolErrorRegex
chakracore: /^TypeError: No implicit conversion of Symbol to String/
}));
}
4 changes: 1 addition & 3 deletions test/parallel/test-whatwg-url-searchparams-has.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,10 @@ test(function() {
valueOf() { throw new Error('valueOf'); }
};
const sym = Symbol();
const chakracoreSymbolErrorRegex =
/^TypeError: Object doesn't support property or method 'ToString'/;
assert.throws(() => params.has(obj), /^Error: toString$/);
assert.throws(() => params.has(sym),
common.engineSpecificMessage({
v8: /^TypeError: Cannot convert a Symbol value to a string$/,
chakracore: chakracoreSymbolErrorRegex
chakracore: /^TypeError: No implicit conversion of Symbol to String/
}));
}
6 changes: 2 additions & 4 deletions test/parallel/test-whatwg-url-searchparams-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,16 @@ test(function() {
valueOf() { throw new Error('valueOf'); }
};
const sym = Symbol();
const chakracoreSymbolErrorRegex =
/^TypeError: Object doesn't support property or method 'ToString'/;
assert.throws(() => params.append(obj, 'b'), /^Error: toString$/);
assert.throws(() => params.append('a', obj), /^Error: toString$/);
assert.throws(() => params.append(sym, 'b'),
common.engineSpecificMessage({
v8: /^TypeError: Cannot convert a Symbol value to a string$/,
chakracore: chakracoreSymbolErrorRegex
chakracore: /^TypeError: No implicit conversion of Symbol to String/
}));
assert.throws(() => params.append('a', sym),
common.engineSpecificMessage({
v8: /^TypeError: Cannot convert a Symbol value to a string$/,
chakracore: chakracoreSymbolErrorRegex
chakracore: /^TypeError: No implicit conversion of Symbol to String/
}));
}
2 changes: 1 addition & 1 deletion test/parallel/test-whatwg-url-setters.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ startURLSettersTests()
assert.throws(() => url[name] = sym,
common.engineSpecificMessage({
v8: /^TypeError: Cannot convert a Symbol value to a string$/, // eslint-disable-line max-len
chakracore: /^TypeError: Object doesn't support property or method 'ToString'$/, // eslint-disable-line max-len
chakracore: /^TypeError: No implicit conversion of Symbol to String/, // eslint-disable-line max-len
}),
`url.${name} = ${String(sym)}`);
}
Expand Down

0 comments on commit c3285df

Please sign in to comment.