From f9ffa71c56ac1fcd98af3091db01e437e351999b Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Mon, 12 Nov 2018 00:01:49 -0500 Subject: [PATCH] Refactor LT tests for parsers: string The tests for the parsing of line terminators 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. --- .../{S7.3_A2.2_T1.js => invalid-string-cr.js} | 10 +++++++--- .../{S7.3_A2.1_T1.js => invalid-string-lf.js} | 11 ++++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) rename test/language/line-terminators/{S7.3_A2.2_T1.js => invalid-string-cr.js} (74%) rename test/language/line-terminators/{S7.3_A2.1_T1.js => invalid-string-lf.js} (74%) diff --git a/test/language/line-terminators/S7.3_A2.2_T1.js b/test/language/line-terminators/invalid-string-cr.js similarity index 74% rename from test/language/line-terminators/S7.3_A2.2_T1.js rename to test/language/line-terminators/invalid-string-cr.js index cb4e39387d..5d7c50e9cc 100644 --- a/test/language/line-terminators/S7.3_A2.2_T1.js +++ b/test/language/line-terminators/invalid-string-cr.js @@ -4,9 +4,13 @@ /*--- info: CARRIAGE RETURN (U+000D) within strings is not allowed es5id: 7.3_A2.2_T1 +esid: sec-line-terminators description: Insert CARRIAGE RETURN (\u000D) into string +negative: + phase: parse + type: SyntaxError ---*/ -assert.throws(SyntaxError, function() { - eval("'\u000Dstr\u000Ding\u000D'"); -}); +$DONOTEVALUATE(); + +' ' diff --git a/test/language/line-terminators/S7.3_A2.1_T1.js b/test/language/line-terminators/invalid-string-lf.js similarity index 74% rename from test/language/line-terminators/S7.3_A2.1_T1.js rename to test/language/line-terminators/invalid-string-lf.js index 424b170278..bd8b43310a 100644 --- a/test/language/line-terminators/S7.3_A2.1_T1.js +++ b/test/language/line-terminators/invalid-string-lf.js @@ -4,9 +4,14 @@ /*--- info: LINE FEED (U+000A) within strings is not allowed es5id: 7.3_A2.1_T1 +esid: sec-line-terminators description: Insert LINE FEED (\u000A) into string +negative: + phase: parse + type: SyntaxError ---*/ -assert.throws(SyntaxError, function() { - eval("'\u000Astr\u000Aing\u000A'"); -}); +$DONOTEVALUATE(); + +' +'