Bug 1066827 - Part9: Add Testcase for Illegal character error. r=Waldo

This commit is contained in:
Tooru Fujisawa 2014-10-24 21:06:00 +02:00
parent 8e307a6686
commit 20812e6912
2 changed files with 1130 additions and 0 deletions

View File

@ -0,0 +1,57 @@
var JSMSG_ILLEGAL_CHARACTER = "illegal character";
function test_reflect(code) {
var caught = false;
try {
Reflect.parse(code);
} catch (e) {
caught = true;
assertEq(e instanceof SyntaxError, true, code);
assertEq(e.message, JSMSG_ILLEGAL_CHARACTER, code);
}
assertEq(caught, true);
}
function test_eval(code) {
var caught = false;
try {
eval(code);
} catch (e) {
caught = true;
assertEq(e instanceof SyntaxError, true, code);
assertEq(e.message, JSMSG_ILLEGAL_CHARACTER, code);
}
assertEq(caught, true);
}
function test(code) {
test_reflect(code);
test_eval(code);
}
test("(function() { 'use asm'; @");
test("(function() { 'use asm'; var @");
test("(function() { 'use asm'; var a @");
test("(function() { 'use asm'; var a = @");
test("(function() { 'use asm'; var a = 1 @");
test("(function() { 'use asm'; var a = 1; @");
test("(function() { 'use asm'; var a = 1; function @");
test("(function() { 'use asm'; var a = 1; function f @");
test("(function() { 'use asm'; var a = 1; function f( @");
test("(function() { 'use asm'; var a = 1; function f() @");
test("(function() { 'use asm'; var a = 1; function f() { @");
test("(function() { 'use asm'; var a = 1; function f() { } @");
test("(function() { 'use asm'; var a = 1; function f() { } var @");
test("(function() { 'use asm'; var a = 1; function f() { } var tbl @");
test("(function() { 'use asm'; var a = 1; function f() { } var tbl = @");
test("(function() { 'use asm'; var a = 1; function f() { } var tbl = [ @");
test("(function() { 'use asm'; var a = 1; function f() { } var tbl = [f @");
test("(function() { 'use asm'; var a = 1; function f() { } var tbl = [f] @");
test("(function() { 'use asm'; var a = 1; function f() { } var tbl = [f]; @");
test("(function() { 'use asm'; var a = 1; function f() { } var tbl = [f]; return @");
test("(function() { 'use asm'; var a = 1; function f() { } var tbl = [f]; return f @");
test("(function() { 'use asm'; var a = 1; function f() { } var tbl = [f]; return f; @");
test("(function() { 'use asm'; var a = 1; function f() { } var tbl = [f]; return f; } @");
test("(function() { 'use asm'; var a = 1; function f() { } var tbl = [f]; return f; }) @");
test("(function() { 'use asm'; var a = 1; function f() { } var tbl = [f]; return f; }); @");

File diff suppressed because it is too large Load Diff