diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 77e6a8d12a4..8c11359b542 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -197,7 +197,8 @@ Function | Purpose `assert.sameValue(actual, expected, message)` | throw a new Test262Error instance if the first two arguments are not [the same value](https://tc39.github.io/ecma262/#sec-samevalue); accepts an optional string message for use in creating the error `assert.notSameValue(actual, unexpected, message)` | throw a new Test262Error instance if the first two arguments are [the same value](https://tc39.github.io/ecma262/#sec-samevalue); accepts an optional string message for use in creating the error `assert.throws(expectedErrorConstructor, fn, message)` | throw a new Test262Error instance if the provided function does not throw an error, or if the constructor of the value thrown does not match the provided constructor -`$DONOTEVALUATE()` | throw an exception if the code gets evaluated. This is useful for [negative test cases for parsing errors](#handling-errors-and-negative-test-cases) +`$DONOTEVALUATE()` | throw an exception if the code gets evaluated. This is useful for [negative test cases for parsing errors](#handling-errors-and-negative-test-cases). +`throw "Test262: This statement should not be evaluated.";` | throw an exception if the code gets evaluated. Use this if the test file has the `raw` flag and it's a negative test case for parsing error. `$ERROR(message)` | construct a Test262Error object and throw it
**DEPRECATED** -- Do not use in new tests. Use `assert`, `assert.*`, or `throw new Test262Error` instead. ```javascript @@ -223,6 +224,21 @@ $DONOTEVALUATE(); var var = var; ``` +If the test case has the `raw` flag, this disallows the test to load any harness file including `$DONOTEVALUATE`. In this case, include a direct `throw "Test262: This statement should not be evaluated.";` statement: + +```javascript +/*--- +flags: [raw] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +var var = var; +``` + Expectations for **runtime errors** should be defined using the `assert.throws` method and the appropriate JavaScript Error constructor function: ```javascript diff --git a/features.txt b/features.txt index cb85ff43d56..df361ca5179 100644 --- a/features.txt +++ b/features.txt @@ -7,6 +7,10 @@ # # https://github.com/tc39/process-document +# Hashbang Grammar +# https://github.com/tc39/proposal-hashbang +hashbang + # Object.fromEntries # https://github.com/tc39/proposal-object-from-entries Object.fromEntries diff --git a/test/language/comments/hashbang/escaped-bang-041.js b/test/language/comments/hashbang/escaped-bang-041.js new file mode 100644 index 00000000000..4051d172724 --- /dev/null +++ b/test/language/comments/hashbang/escaped-bang-041.js @@ -0,0 +1,16 @@ +#\041 +/*--- +esid: pending +description: > + Hashbang comments should not be allowed to have encoded characters \041 +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/test/language/comments/hashbang/escaped-bang-u0021.js b/test/language/comments/hashbang/escaped-bang-u0021.js new file mode 100644 index 00000000000..b10c8a3e97d --- /dev/null +++ b/test/language/comments/hashbang/escaped-bang-u0021.js @@ -0,0 +1,16 @@ +#\u0021 +/*--- +esid: pending +description: > + Hashbang comments should not be allowed to have encoded characters \u0021 +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/test/language/comments/hashbang/escaped-bang-u21.js b/test/language/comments/hashbang/escaped-bang-u21.js new file mode 100644 index 00000000000..d5bbb340c0b --- /dev/null +++ b/test/language/comments/hashbang/escaped-bang-u21.js @@ -0,0 +1,16 @@ +#\u{21} +/*--- +esid: pending +description: > + Hashbang comments should not be allowed to have encoded characters \u{21} +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/test/language/comments/hashbang/escaped-bang-x21.js b/test/language/comments/hashbang/escaped-bang-x21.js new file mode 100644 index 00000000000..4ddffcc2fab --- /dev/null +++ b/test/language/comments/hashbang/escaped-bang-x21.js @@ -0,0 +1,16 @@ +#\x21 +/*--- +esid: pending +description: > + Hashbang comments should not be allowed to have encoded characters \x21 +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/test/language/comments/hashbang/escaped-hash-043.js b/test/language/comments/hashbang/escaped-hash-043.js new file mode 100644 index 00000000000..1caefb36825 --- /dev/null +++ b/test/language/comments/hashbang/escaped-hash-043.js @@ -0,0 +1,16 @@ +\043! +/*--- +esid: pending +description: > + Hashbang comments should not be allowed to have encoded characters \043 +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/test/language/comments/hashbang/escaped-hash-u0023.js b/test/language/comments/hashbang/escaped-hash-u0023.js new file mode 100644 index 00000000000..41c337cfb8c --- /dev/null +++ b/test/language/comments/hashbang/escaped-hash-u0023.js @@ -0,0 +1,16 @@ +\u0023! +/*--- +esid: pending +description: > + Hashbang comments should not be allowed to have encoded characters \u0023 +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/test/language/comments/hashbang/escaped-hash-u23.js b/test/language/comments/hashbang/escaped-hash-u23.js new file mode 100644 index 00000000000..4ff6c89aa45 --- /dev/null +++ b/test/language/comments/hashbang/escaped-hash-u23.js @@ -0,0 +1,16 @@ +\u{23}! +/*--- +esid: pending +description: > + Hashbang comments should not be allowed to have encoded characters \u{23} +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/test/language/comments/hashbang/escaped-hash-x23.js b/test/language/comments/hashbang/escaped-hash-x23.js new file mode 100644 index 00000000000..da78beb2d4c --- /dev/null +++ b/test/language/comments/hashbang/escaped-hash-x23.js @@ -0,0 +1,16 @@ +\x23! +/*--- +esid: pending +description: > + Hashbang comments should not be allowed to have encoded characters \x23 +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/test/language/comments/hashbang/escaped-hashbang.js b/test/language/comments/hashbang/escaped-hashbang.js new file mode 100644 index 00000000000..493acd445bc --- /dev/null +++ b/test/language/comments/hashbang/escaped-hashbang.js @@ -0,0 +1,16 @@ +\u0023\u0021 +/*--- +esid: pending +description: > + Hashbang comments should not be allowed to have encoded characters +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/test/language/comments/hashbang/eval-indirect.js b/test/language/comments/hashbang/eval-indirect.js new file mode 100644 index 00000000000..1dcc8e2b576 --- /dev/null +++ b/test/language/comments/hashbang/eval-indirect.js @@ -0,0 +1,13 @@ +/*--- +esid: pending +description: > + Hashbang comments should be available in Script evaluator contexts. (indirect eval) +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +features: [hashbang] +---*/ + +assert.sameValue((0, eval)('#!\n'), undefined); +assert.sameValue((0, eval)('#!\n1'), 1) +assert.sameValue((0, eval)('#!2\n'), undefined); diff --git a/test/language/comments/hashbang/eval.js b/test/language/comments/hashbang/eval.js new file mode 100644 index 00000000000..62cdadf5d48 --- /dev/null +++ b/test/language/comments/hashbang/eval.js @@ -0,0 +1,13 @@ +/*--- +esid: pending +description: > + Hashbang comments should be available in Script evaluator contexts. (direct eval) +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +features: [hashbang] +---*/ + +assert.sameValue(eval('#!\n'), undefined); +assert.sameValue(eval('#!\n1'), 1) +assert.sameValue(eval('#!2\n'), undefined); diff --git a/test/language/comments/hashbang/function-body.js b/test/language/comments/hashbang/function-body.js new file mode 100644 index 00000000000..9982ec09e2d --- /dev/null +++ b/test/language/comments/hashbang/function-body.js @@ -0,0 +1,17 @@ +/*--- +esid: pending +description: > + Hashbang comments should only be allowed at the start of source texts and should not be allowed within function bodies. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +$DONOTEVALUATE(); + +function fn() {#! +} diff --git a/test/language/comments/hashbang/function-constructor.js b/test/language/comments/hashbang/function-constructor.js new file mode 100644 index 00000000000..9d98a1736bc --- /dev/null +++ b/test/language/comments/hashbang/function-constructor.js @@ -0,0 +1,24 @@ +/*--- +esid: pending +description: > + Hashbang comments should not be allowed in function evaluator contexts. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +features: [hashbang] +---*/ + +const AsyncFunction = (async function (){}).constructor; +const GeneratorFunction = (function *(){}).constructor; +const AsyncGeneratorFunction = (async function *(){}).constructor; +for (const ctor of [ + Function, + AsyncFunction, + GeneratorFunction, + AsyncGeneratorFunction, +]) { + assert.throws(SyntaxError, () => ctor('#!\n_', ''), `${ctor.name} Call argument`); + assert.throws(SyntaxError, () => ctor('#!\n_'), `${ctor.name} Call body`); + assert.throws(SyntaxError, () => new ctor('#!\n_', ''), `${ctor.name} Construct argument`); + assert.throws(SyntaxError, () => new ctor('#!\n_'), `${ctor.name} Construct body`); +} diff --git a/test/language/comments/hashbang/module.js b/test/language/comments/hashbang/module.js new file mode 100644 index 00000000000..d153305551c --- /dev/null +++ b/test/language/comments/hashbang/module.js @@ -0,0 +1,11 @@ +#! +/*--- +esid: pending +description: > + Hashbang comments should be allowed in Modules. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [module, raw] +features: [hashbang] +---*/ diff --git a/test/language/comments/hashbang/multi-line-comment.js b/test/language/comments/hashbang/multi-line-comment.js new file mode 100644 index 00000000000..3e6c69cadbe --- /dev/null +++ b/test/language/comments/hashbang/multi-line-comment.js @@ -0,0 +1,17 @@ +#!/* +throw "Test262: This statement should not be evaluated."; +these characters should not be considered within a comment +*/ +/*--- +esid: pending +description: > + Hashbang comments should not interpret multi-line comments. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ diff --git a/test/language/comments/hashbang/no-line-separator.js b/test/language/comments/hashbang/no-line-separator.js new file mode 100644 index 00000000000..2fd1778fd78 --- /dev/null +++ b/test/language/comments/hashbang/no-line-separator.js @@ -0,0 +1,11 @@ +/*--- +esid: pending +description: > + Hashbang comments should not require a newline afterwards +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +features: [hashbang] +---*/ + +assert.sameValue(eval('#!'), undefined); diff --git a/test/language/comments/hashbang/not-empty.js b/test/language/comments/hashbang/not-empty.js new file mode 100644 index 00000000000..ab03aed633b --- /dev/null +++ b/test/language/comments/hashbang/not-empty.js @@ -0,0 +1,11 @@ +#! these characters should be treated as a comment +/*--- +esid: pending +description: > + Hashbang comments should be allowed in Scripts and should not be required to be empty. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +features: [hashbang] +---*/ diff --git a/test/language/comments/hashbang/preceding-directive-prologue-sc.js b/test/language/comments/hashbang/preceding-directive-prologue-sc.js new file mode 100644 index 00000000000..450aeec1241 --- /dev/null +++ b/test/language/comments/hashbang/preceding-directive-prologue-sc.js @@ -0,0 +1,17 @@ +"use strict"; +#! +/*--- +esid: pending +description: > + Hashbang comments should only be allowed at start of source texts and should not be preceded by DirectivePrologues. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/test/language/comments/hashbang/preceding-directive-prologue.js b/test/language/comments/hashbang/preceding-directive-prologue.js new file mode 100644 index 00000000000..54e2f4123c1 --- /dev/null +++ b/test/language/comments/hashbang/preceding-directive-prologue.js @@ -0,0 +1,17 @@ +"use strict" +#! +/*--- +esid: pending +description: > + Hashbang comments should only be allowed at start of source texts and should not be preceded by DirectivePrologues. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/test/language/comments/hashbang/preceding-empty-statement.js b/test/language/comments/hashbang/preceding-empty-statement.js new file mode 100644 index 00000000000..dc346178372 --- /dev/null +++ b/test/language/comments/hashbang/preceding-empty-statement.js @@ -0,0 +1,16 @@ +;#! +/*--- +esid: pending +description: > + Hashbang comments should only be allowed at the start of source texts and should not be preceded by empty statements. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/test/language/comments/hashbang/preceding-hashbang.js b/test/language/comments/hashbang/preceding-hashbang.js new file mode 100644 index 00000000000..61ee3f7d3a7 --- /dev/null +++ b/test/language/comments/hashbang/preceding-hashbang.js @@ -0,0 +1,17 @@ +#! +#! +/*--- +esid: pending +description: > + Hashbang comments should only be allowed at the start of source texts and should not be preceded by Hashbang comments. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/test/language/comments/hashbang/preceding-line-comment.js b/test/language/comments/hashbang/preceding-line-comment.js new file mode 100644 index 00000000000..1a54a7e8821 --- /dev/null +++ b/test/language/comments/hashbang/preceding-line-comment.js @@ -0,0 +1,17 @@ +// +#! +/*--- +esid: pending +description: > + Hashbang comments should only be allowed at the start of source texts and should not be preceded by line comments. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/test/language/comments/hashbang/preceding-multi-line-comment.js b/test/language/comments/hashbang/preceding-multi-line-comment.js new file mode 100644 index 00000000000..1c44bbfd29d --- /dev/null +++ b/test/language/comments/hashbang/preceding-multi-line-comment.js @@ -0,0 +1,17 @@ +/* +*/#! +/*--- +esid: pending +description: > + Hashbang comments should only be allowed at the start of source texts and should not be preceded by multi-line comments. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/test/language/comments/hashbang/preceding-whitespace.js b/test/language/comments/hashbang/preceding-whitespace.js new file mode 100644 index 00000000000..3afb2f3c8d5 --- /dev/null +++ b/test/language/comments/hashbang/preceding-whitespace.js @@ -0,0 +1,16 @@ + #! +/*--- +esid: pending +description: > + Hashbang comments should only be allowed at the start of source texts and should not be preceded by whitespace. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/test/language/comments/hashbang/statement-block.js b/test/language/comments/hashbang/statement-block.js new file mode 100644 index 00000000000..029ae1d9875 --- /dev/null +++ b/test/language/comments/hashbang/statement-block.js @@ -0,0 +1,18 @@ +/*--- +esid: pending +description: > + Hashbang comments should only be allowed at the start of source texts and should not be allowed within blocks. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +$DONOTEVALUATE(); + +{ + #! +} diff --git a/test/language/comments/hashbang/use-strict.js b/test/language/comments/hashbang/use-strict.js new file mode 100644 index 00000000000..0c6ecdfbfd2 --- /dev/null +++ b/test/language/comments/hashbang/use-strict.js @@ -0,0 +1,13 @@ +#!"use strict" +/*--- +esid: pending +description: > + Hashbang comments should not be interpreted and should not generate DirectivePrologues. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw, noStrict] +features: [hashbang] +---*/ + +with ({}) {} diff --git a/tools/lint/lib/checks/license.py b/tools/lint/lib/checks/license.py index 36439396301..f6bc4b87bb6 100644 --- a/tools/lint/lib/checks/license.py +++ b/tools/lint/lib/checks/license.py @@ -31,7 +31,7 @@ def run(self, name, meta, source): match = _LICENSE_PATTERN.search(source) if not match: - return 'No license information found.' + return year_str = match.group(2) try: diff --git a/tools/lint/lib/checks/negative.py b/tools/lint/lib/checks/negative.py index 7a06368c27b..4357aa4d324 100755 --- a/tools/lint/lib/checks/negative.py +++ b/tools/lint/lib/checks/negative.py @@ -5,6 +5,10 @@ r'^\$DONOTEVALUATE\(\);$', re.MULTILINE) +_THROW_STMT_LEGACY = re.compile( + r'^throw "Test262: This statement should not be evaluated\.";$', + re.MULTILINE) + class CheckNegative(Check): '''Ensure tests have the expected YAML-formatted metadata.''' ID = 'NEGATIVE' @@ -23,5 +27,9 @@ def run(self, name, meta, source): if not 'phase' in negative: return '"negative" must specify a "phase" field' - if negative["phase"] in ["parse", "resolution"] and not _THROW_STMT.search(source): - return 'Negative tests of type "early" must include a `throw` statement' + if negative["phase"] in ["parse", "resolution"]: + if meta.get('flags') and 'raw' in meta['flags']: + if not _THROW_STMT_LEGACY.search(source): + return 'Negative tests of type "early" must include a `throw` statement' + elif not _THROW_STMT.search(source): + return 'Negative tests of type "early" must include a $DONOTEVALUATE() call' diff --git a/tools/lint/test/fixtures/license_missing.js b/tools/lint/test/fixtures/license_missing.js index 3d90cf27f3c..e981dc7dbef 100644 --- a/tools/lint/test/fixtures/license_missing.js +++ b/tools/lint/test/fixtures/license_missing.js @@ -1,4 +1,3 @@ -LICENSE ^ expected errors | v input /*--- esid: sec-assignment-operators-static-semantics-early-errors diff --git a/tools/lint/test/fixtures/negative_missing_phase.js b/tools/lint/test/fixtures/negative_missing_phase.js index e830d423852..04ae5e8f58c 100644 --- a/tools/lint/test/fixtures/negative_missing_phase.js +++ b/tools/lint/test/fixtures/negative_missing_phase.js @@ -9,4 +9,6 @@ negative: type: SyntaxError ---*/ +$DONOTEVALUATE(); + !!! diff --git a/tools/lint/test/fixtures/negative_missing_type.js b/tools/lint/test/fixtures/negative_missing_type.js index 8642c9124d4..04a8bb889da 100644 --- a/tools/lint/test/fixtures/negative_missing_type.js +++ b/tools/lint/test/fixtures/negative_missing_type.js @@ -9,4 +9,6 @@ negative: phase: early ---*/ +$DONOTEVALUATE(); + !!! diff --git a/tools/lint/test/fixtures/negative_no_raw_stmt.js b/tools/lint/test/fixtures/negative_no_raw_stmt.js new file mode 100644 index 00000000000..9162b68a40a --- /dev/null +++ b/tools/lint/test/fixtures/negative_no_raw_stmt.js @@ -0,0 +1,14 @@ +^ expected errors | v input +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +description: Minimal test +negative: + type: SyntaxError + phase: parse +---*/ + +$DONOTEVALUATE(); + +!!! diff --git a/tools/lint/test/fixtures/negative_no_raw_wrong_stmt.js b/tools/lint/test/fixtures/negative_no_raw_wrong_stmt.js new file mode 100644 index 00000000000..62e7d7fb57d --- /dev/null +++ b/tools/lint/test/fixtures/negative_no_raw_wrong_stmt.js @@ -0,0 +1,15 @@ +NEGATIVE +^ expected errors | v input +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +description: Minimal test +negative: + type: SyntaxError + phase: parse +---*/ + +throw "Test262: This statement should not be evaluated!"; + +!!! diff --git a/tools/lint/test/fixtures/negative_parse_throw_bad_value.js b/tools/lint/test/fixtures/negative_parse_throw_bad_value.js index 2e9510183d1..a4457c72f7f 100644 --- a/tools/lint/test/fixtures/negative_parse_throw_bad_value.js +++ b/tools/lint/test/fixtures/negative_parse_throw_bad_value.js @@ -10,6 +10,6 @@ negative: phase: parse ---*/ -throw "Test262: This statement should not be evaluated!"; +$DONOTEVALUATE(1); !!! diff --git a/tools/lint/test/fixtures/negative_raw_call.js b/tools/lint/test/fixtures/negative_raw_call.js new file mode 100644 index 00000000000..52f6014c2f3 --- /dev/null +++ b/tools/lint/test/fixtures/negative_raw_call.js @@ -0,0 +1,15 @@ +^ expected errors | v input +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +description: Minimal test +negative: + type: SyntaxError + phase: parse +flags: [raw] +---*/ + +throw "Test262: This statement should not be evaluated."; + +!!! diff --git a/tools/lint/test/fixtures/negative_raw_wrong_call.js b/tools/lint/test/fixtures/negative_raw_wrong_call.js new file mode 100644 index 00000000000..55bfa6f5153 --- /dev/null +++ b/tools/lint/test/fixtures/negative_raw_wrong_call.js @@ -0,0 +1,16 @@ +NEGATIVE +^ expected errors | v input +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +description: Minimal test +negative: + type: SyntaxError + phase: parse +flags: [raw] +---*/ + +$DONOTEVALUATE(); + +!!! diff --git a/tools/lint/test/fixtures/negative_resolution_throw_bad_value.js b/tools/lint/test/fixtures/negative_resolution_throw_bad_value.js index daf09d5e87d..507e3cb935e 100644 --- a/tools/lint/test/fixtures/negative_resolution_throw_bad_value.js +++ b/tools/lint/test/fixtures/negative_resolution_throw_bad_value.js @@ -11,6 +11,6 @@ negative: phase: resolution ---*/ -throw "Test262: This statement should not be evaluated!"; +$DONOTEVALUATE(1); import 'non-existent-module.js';