Refactor literal tests for parsers

The tests for the parsing of literal values were expressed using eval.
This made the tests more complex than necessary and also prevented the
tests from providing value to ECMAScript parsers.

Remove the use of eval and instead express the expectations with literal
source text. Rename the files to make each test's purpose more clear.
This commit is contained in:
Mike Pennisi 2019-03-31 20:19:49 -04:00
parent 937d0b1df1
commit e0120fcbd6
6 changed files with 30 additions and 54 deletions

View File

@ -4,16 +4,12 @@
/*--- /*---
es5id: 7.8.3-6-s es5id: 7.8.3-6-s
description: Strict Mode - octal extension (000) is forbidden in strict mode description: Strict Mode - octal extension (000) is forbidden in strict mode
negative:
phase: parse
type: SyntaxError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
var err = null; $DONOTEVALUATE();
try { 000;
eval("var _7_8_3_6 = 000;");
} catch (e) {
err = e;
}
assert(err instanceof SyntaxError);
assert.sameValue(typeof _7_8_3_6, "undefined");

View File

@ -4,16 +4,12 @@
/*--- /*---
es5id: 7.8.3-7-s es5id: 7.8.3-7-s
description: Strict Mode - octal extension (005) is forbidden in strict mode description: Strict Mode - octal extension (005) is forbidden in strict mode
negative:
phase: parse
type: SyntaxError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
var err = null; $DONOTEVALUATE();
try { 005;
eval("var _7_8_3_7 = 005;");
} catch (e) {
err = e;
}
assert(err instanceof SyntaxError);
assert.sameValue(typeof _7_8_3_7, "undefined");

View File

@ -4,16 +4,12 @@
/*--- /*---
es5id: 7.8.3-3-s es5id: 7.8.3-3-s
description: Strict Mode - octal extension (01) is forbidden in strict mode description: Strict Mode - octal extension (01) is forbidden in strict mode
negative:
phase: parse
type: SyntaxError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
var err = null; $DONOTEVALUATE();
try { 01;
eval("var _7_8_3_3 = 01;");
} catch (e) {
err = e;
}
assert(err instanceof SyntaxError);
assert.sameValue(typeof _7_8_3_3, "undefined");

View File

@ -4,16 +4,12 @@
/*--- /*---
es5id: 7.8.3-1-s es5id: 7.8.3-1-s
description: Strict Mode - octal extension (010) is forbidden in strict mode description: Strict Mode - octal extension (010) is forbidden in strict mode
negative:
phase: parse
type: SyntaxError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
var err = null; $DONOTEVALUATE();
try { 010;
eval("var _7_8_3_1 = 010;");
} catch (e) {
err = e;
}
assert(err instanceof SyntaxError);
assert.sameValue(typeof _7_8_3_1, "undefined");

View File

@ -4,16 +4,12 @@
/*--- /*---
es5id: 7.8.3-4-s es5id: 7.8.3-4-s
description: Strict Mode - octal extension (06) is forbidden in strict mode description: Strict Mode - octal extension (06) is forbidden in strict mode
negative:
phase: parse
type: SyntaxError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
var err = null; $DONOTEVALUATE();
try { 06;
eval("var _7_8_3_4 = 06;");
} catch (e) {
err = e;
}
assert(err instanceof SyntaxError);
assert.sameValue(typeof _7_8_3_4, "undefined");

View File

@ -4,16 +4,12 @@
/*--- /*---
es5id: 7.8.3-5-s es5id: 7.8.3-5-s
description: Strict Mode - octal extension (07) is forbidden in strict mode description: Strict Mode - octal extension (07) is forbidden in strict mode
negative:
phase: parse
type: SyntaxError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
var err = null; $DONOTEVALUATE();
try { 07;
eval("var _7_8_3_5 = 07;");
} catch (e) {
err = e;
}
assert(err instanceof SyntaxError);
assert.sameValue(typeof _7_8_3_5, "undefined");