Skip to content
Snippets Groups Projects
Commit 496771cd authored by Valerie's avatar Valerie Committed by Leo Balter
Browse files

BigInt: fix error type in BigInt from string conversion (#1487)

parent b1bbf08b
No related branches found
No related tags found
No related merge requests found
...@@ -47,19 +47,19 @@ testWithBigIntTypedArrayConstructors(function(TA) { ...@@ -47,19 +47,19 @@ testWithBigIntTypedArrayConstructors(function(TA) {
assert.sameValue(typedArray[0], 0n); assert.sameValue(typedArray[0], 0n);
assert.sameValue(typedArray[1], 1n); assert.sameValue(typedArray[1], 1n);
assert.throws(TypeError, function() { assert.throws(SyntaxError, function() {
typedArray.set(['1n']); typedArray.set(['1n']);
}, "A StringNumericLiteral may not include a BigIntLiteralSuffix."); }, "A StringNumericLiteral may not include a BigIntLiteralSuffix.");
assert.throws(TypeError, function() { assert.throws(SyntaxError, function() {
typedArray.set(["Infinity"]); typedArray.set(["Infinity"]);
}, "Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow Infinity.."); }, "Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow Infinity..");
assert.throws(TypeError, function() { assert.throws(SyntaxError, function() {
typedArray.set(["1.1"]); typedArray.set(["1.1"]);
}, "Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow... decimal points..."); }, "Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow... decimal points...");
assert.throws(TypeError, function() { assert.throws(SyntaxError, function() {
typedArray.set(["1e7"]); typedArray.set(["1e7"]);
}, "Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow... exponents..."); }, "Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow... exponents...");
......
...@@ -58,19 +58,19 @@ testWithBigIntTypedArrayConstructors(function(TA) { ...@@ -58,19 +58,19 @@ testWithBigIntTypedArrayConstructors(function(TA) {
assert.sameValue(typedArray[0], 0n); assert.sameValue(typedArray[0], 0n);
assert.sameValue(typedArray[1], 1n); assert.sameValue(typedArray[1], 1n);
assert.throws(TypeError, function() { assert.throws(SyntaxError, function() {
new TA(["1n"]); new TA(["1n"]);
}, "A StringNumericLiteral may not include a BigIntLiteralSuffix."); }, "A StringNumericLiteral may not include a BigIntLiteralSuffix.");
assert.throws(TypeError, function() { assert.throws(SyntaxError, function() {
new TA(["Infinity"]); new TA(["Infinity"]);
}, "Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow Infinity.."); }, "Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow Infinity..");
assert.throws(TypeError, function() { assert.throws(SyntaxError, function() {
new TA(["1.1"]); new TA(["1.1"]);
}, "Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow... decimal points..."); }, "Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow... decimal points...");
assert.throws(TypeError, function() { assert.throws(SyntaxError, function() {
new TA(["1e7"]); new TA(["1e7"]);
}, "Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow... exponents..."); }, "Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow... exponents...");
......
...@@ -70,19 +70,19 @@ testWithBigIntTypedArrayConstructors(function(TA) { ...@@ -70,19 +70,19 @@ testWithBigIntTypedArrayConstructors(function(TA) {
typedArray[0] = '1'; typedArray[0] = '1';
assert.sameValue(typedArray[0], 1n); assert.sameValue(typedArray[0], 1n);
assert.throws(TypeError, function() { assert.throws(SyntaxError, function() {
typedArray[0] = '1n'; typedArray[0] = '1n';
}, "A StringNumericLiteral may not include a BigIntLiteralSuffix."); }, "A StringNumericLiteral may not include a BigIntLiteralSuffix.");
assert.throws(TypeError, function() { assert.throws(SyntaxError, function() {
typedArray[0] = "Infinity"; typedArray[0] = "Infinity";
}, "Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow Infinity.."); }, "Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow Infinity..");
assert.throws(TypeError, function() { assert.throws(SyntaxError, function() {
typedArray[0] = "1.1"; typedArray[0] = "1.1";
}, "Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow... decimal points..."); }, "Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow... decimal points...");
assert.throws(TypeError, function() { assert.throws(SyntaxError, function() {
typedArray[0] = "1e7"; typedArray[0] = "1e7";
}, "Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow... exponents..."); }, "Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow... exponents...");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment