Test runtime errors with assertion utility method

Improve test consistency by using the `assert.throws` helper function to
assert runtime exceptions. Remove superfluous code.
This commit is contained in:
Mike Pennisi 2016-03-13 14:33:01 -04:00
parent fb61ab44eb
commit 24e774251a
17 changed files with 52 additions and 58 deletions

View File

@ -5,8 +5,8 @@
info: Line Terminator between LeftHandSideExpression and "--" is not allowed
es5id: 11.3.2_A1.1_T1
description: Checking Line Feed
negative: SyntaxError
---*/
//CHECK#1
eval("var x = 1; x\u000A--");
assert.throws(SyntaxError, function() {
eval("var x = 1; x\u000A--");
});

View File

@ -5,8 +5,8 @@
info: Line Terminator between LeftHandSideExpression and "--" is not allowed
es5id: 11.3.2_A1.1_T2
description: Checking Carriage Return
negative: SyntaxError
---*/
//CHECK#1
eval("var x = 1; x\u000D--");
assert.throws(SyntaxError, function() {
eval("var x = 1; x\u000D--");
});

View File

@ -5,8 +5,8 @@
info: Line Terminator between LeftHandSideExpression and "--" is not allowed
es5id: 11.3.2_A1.1_T3
description: Checking Page separator
negative: SyntaxError
---*/
//CHECK#1
eval("var x = 1; x\u2028--");
assert.throws(SyntaxError, function() {
eval("var x = 1; x\u2028--");
});

View File

@ -5,8 +5,8 @@
info: Line Terminator between LeftHandSideExpression and "--" is not allowed
es5id: 11.3.2_A1.1_T4
description: Checking Line separator
negative: SyntaxError
---*/
//CHECK#1
eval("var x = 1; x\u2029--");
assert.throws(SyntaxError, function() {
eval("var x = 1; x\u2029--");
});

View File

@ -5,8 +5,8 @@
info: Line Terminator between LeftHandSideExpression and "++" is not allowed
es5id: 11.3.1_A1.1_T1
description: Checking Line Feed
negative: SyntaxError
---*/
//CHECK#1
eval("var x = 1; x\u000A++");
assert.throws(SyntaxError, function() {
eval("var x = 1; x\u000A++");
});

View File

@ -5,8 +5,8 @@
info: Line Terminator between LeftHandSideExpression and "++" is not allowed
es5id: 11.3.1_A1.1_T2
description: Carriage Return
negative: SyntaxError
---*/
//CHECK#1
eval("var x = 1; x\u000D++");
assert.throws(SyntaxError, function() {
eval("var x = 1; x\u000D++");
});

View File

@ -5,8 +5,8 @@
info: Line Terminator between LeftHandSideExpression and "++" is not allowed
es5id: 11.3.1_A1.1_T3
description: Checking Line Seprator
negative: SyntaxError
---*/
//CHECK#1
eval("var x = 1; x\u2028++");
assert.throws(SyntaxError, function() {
eval("var x = 1; x\u2028++");
});

View File

@ -5,8 +5,8 @@
info: Line Terminator between LeftHandSideExpression and "++" is not allowed
es5id: 11.3.1_A1.1_T4
description: Checking Paragraph separator
negative: SyntaxError
---*/
//CHECK#1
eval("var x = 1; x\u2029++");
assert.throws(SyntaxError, function() {
eval("var x = 1; x\u2029++");
});

View File

@ -5,10 +5,8 @@
info: LINE FEED (U+000A) within strings is not allowed
es5id: 7.3_A2.1_T1
description: Insert LINE FEED (\u000A) into string
negative: SyntaxError
---*/
// CHECK#1
if (eval("'\u000Astr\u000Aing\u000A'") === "\u000Astr\u000Aing\u000A") {
$ERROR('#1: eval("\'\\u000Astr\\u000Aing\\u000A\'") === "\\u000Astr\\u000Aing\\u000A"');
}
assert.throws(SyntaxError, function() {
eval("'\u000Astr\u000Aing\u000A'");
});

View File

@ -5,10 +5,8 @@
info: CARRIAGE RETURN (U+000D) within strings is not allowed
es5id: 7.3_A2.2_T1
description: Insert CARRIAGE RETURN (\u000D) into string
negative: SyntaxError
---*/
// CHECK#1
if (eval("'\u000Dstr\u000Ding\u000D'") === "\u000Dstr\u000Ding\u000D") {
$ERROR('#1: eval("\'\\u000Dstr\\u000Ding\\u000D\'") === "\\u000Dstr\\u000Ding\\u000D"');
}
assert.throws(SyntaxError, function() {
eval("'\u000Dstr\u000Ding\u000D'");
});

View File

@ -5,10 +5,8 @@
info: LINE SEPARATOR (U+2028) within strings is not allowed
es5id: 7.3_A2.3
description: Insert LINE SEPARATOR (\u2028) into string
negative: SyntaxError
---*/
// CHECK#1
if (eval("'\u2028str\u2028ing\u2028'") === "\u2028str\u2028ing\u2028") {
$ERROR('#1: eval("\'\\u2028str\\u2028ing\\u2028\'") === "\\u2028str\\u2028ing\\u2028"');
}
assert.throws(SyntaxError, function() {
eval("'\u2028str\u2028ing\u2028'");
});

View File

@ -5,10 +5,9 @@
info: PARAGRAPH SEPARATOR (U+2029) within strings is not allowed
es5id: 7.3_A2.4
description: Insert PARAGRAPH SEPARATOR (\u2029) into string
negative: SyntaxError
---*/
// CHECK#1
if (eval("'\u2029str\u2029ing\u2029'") === "\u2029str\u2029ing\u2029") {
$ERROR('#1: eval("\'\\u2029str\\u2029ing\\u2029\'") === "\\u2029str\\u2029ing\\u2029"');
}
assert.throws(SyntaxError, function() {
eval("'\u2029str\u2029ing\u2029'");
});

View File

@ -5,8 +5,8 @@
info: Single line comments can not contain LINE FEED (U+000A) inside
es5id: 7.3_A3.1_T2
description: Insert LINE FEED (\u000A) into begin of single line comment
negative: SyntaxError
---*/
// CHECK#1
eval("//\u000A single line comment");
assert.throws(SyntaxError, function() {
eval("//\u000A single line comment");
});

View File

@ -5,8 +5,8 @@
info: Single line comments can not contain CARRIAGE RETURN (U+000D) inside
es5id: 7.3_A3.2_T2
description: Insert CARRIAGE RETURN (\u000D) into begin of single line comment
negative: SyntaxError
---*/
// CHECK#1
eval("//\u000D single line comment");
assert.throws(SyntaxError, function() {
eval("//\u000D single line comment");
});

View File

@ -5,8 +5,8 @@
info: Single line comments can not contain LINE SEPARATOR (U+2028) inside
es5id: 7.3_A3.3_T2
description: Insert LINE SEPARATOR (\u2028) into begin of single line comment
negative: SyntaxError
---*/
// CHECK#1
eval("//\u2028 single line comment");
assert.throws(SyntaxError, function() {
eval("//\u2028 single line comment");
});

View File

@ -7,8 +7,8 @@ es5id: 7.3_A3.4_T2
description: >
Insert PARAGRAPH SEPARATOR (\u2029) into begin of single line
comment
negative: SyntaxError
---*/
// CHECK#1
eval("//\u2029 single line comment");
assert.throws(SyntaxError, function() {
eval("//\u2029 single line comment");
});

View File

@ -6,9 +6,10 @@ es5id: 7.8.3-3gs
description: >
Strict Mode - octal extension is forbidden in strict mode (after a
hex number is assigned to a variable from an eval)
negative: SyntaxError
flags: [onlyStrict]
---*/
var a;
eval("a = 0x1;a = 01;");
var a;
assert.throws(SyntaxError, function() {
eval("a = 0x1;a = 01;");
});