Test cases for invalid escape sequences preceding "use strict". Fixes gh-2893

This commit is contained in:
Rick Waldron 2020-11-03 14:27:04 -05:00
parent 3d3c56200b
commit 1c33fdb0ca
9 changed files with 234 additions and 0 deletions

View File

@ -0,0 +1,26 @@
// Copyright (C) 2020 Rick Waldron Inc. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-additional-syntax-string-literals
description: >
String Literals extensions disallowed in strict mode; ZeroToThree 1
info: |
It is possible for string literals to precede a Use Strict Directive that places the enclosing
code in strict mode, and implementations must take care to not use this extended definition of
EscapeSequence with such literals. For example, attempting to parse the following source text
must fail.
Strict mode is entered via the explicit Use Strict Directive.
ZeroToThree::one of
0 1 2 3
flags: [noStrict]
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
function invalid() { "\1"; "use strict"; }

View File

@ -0,0 +1,26 @@
// Copyright (C) 2020 Rick Waldron Inc. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-additional-syntax-string-literals
description: >
String Literals extensions disallowed in strict mode; ZeroToThree 2
info: |
It is possible for string literals to precede a Use Strict Directive that places the enclosing
code in strict mode, and implementations must take care to not use this extended definition of
EscapeSequence with such literals. For example, attempting to parse the following source text
must fail.
Strict mode is entered via the explicit Use Strict Directive.
ZeroToThree::one of
0 1 2 3
flags: [noStrict]
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
function invalid() { "\2"; "use strict"; }

View File

@ -0,0 +1,26 @@
// Copyright (C) 2020 Rick Waldron Inc. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-additional-syntax-string-literals
description: >
String Literals extensions disallowed in strict mode; ZeroToThree 3
info: |
It is possible for string literals to precede a Use Strict Directive that places the enclosing
code in strict mode, and implementations must take care to not use this extended definition of
EscapeSequence with such literals. For example, attempting to parse the following source text
must fail.
Strict mode is entered via the explicit Use Strict Directive.
ZeroToThree::one of
0 1 2 3
flags: [noStrict]
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
function invalid() { "\3"; "use strict"; }

View File

@ -0,0 +1,26 @@
// Copyright (C) 2020 Rick Waldron Inc. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-additional-syntax-string-literals
description: >
String Literals extensions disallowed in strict mode; FourToSeven 4
info: |
It is possible for string literals to precede a Use Strict Directive that places the enclosing
code in strict mode, and implementations must take care to not use this extended definition of
EscapeSequence with such literals. For example, attempting to parse the following source text
must fail.
Strict mode is entered via the explicit Use Strict Directive.
FourToSeven::one of
4 5 6 7
flags: [noStrict]
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
function invalid() { "\4"; "use strict"; }

View File

@ -0,0 +1,26 @@
// Copyright (C) 2020 Rick Waldron Inc. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-additional-syntax-string-literals
description: >
String Literals extensions disallowed in strict mode; FourToSeven 5
info: |
It is possible for string literals to precede a Use Strict Directive that places the enclosing
code in strict mode, and implementations must take care to not use this extended definition of
EscapeSequence with such literals. For example, attempting to parse the following source text
must fail.
Strict mode is entered via the explicit Use Strict Directive.
FourToSeven::one of
4 5 6 7
flags: [noStrict]
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
function invalid() { "\5"; "use strict"; }

View File

@ -0,0 +1,26 @@
// Copyright (C) 2020 Rick Waldron Inc. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-additional-syntax-string-literals
description: >
String Literals extensions disallowed in strict mode; FourToSeven 6
info: |
It is possible for string literals to precede a Use Strict Directive that places the enclosing
code in strict mode, and implementations must take care to not use this extended definition of
EscapeSequence with such literals. For example, attempting to parse the following source text
must fail.
Strict mode is entered via the explicit Use Strict Directive.
FourToSeven::one of
4 5 6 7
flags: [noStrict]
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
function invalid() { "\6"; "use strict"; }

View File

@ -0,0 +1,26 @@
// Copyright (C) 2020 Rick Waldron Inc. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-additional-syntax-string-literals
description: >
String Literals extensions disallowed in strict mode; FourToSeven 7
info: |
It is possible for string literals to precede a Use Strict Directive that places the enclosing
code in strict mode, and implementations must take care to not use this extended definition of
EscapeSequence with such literals. For example, attempting to parse the following source text
must fail.
Strict mode is entered via the explicit Use Strict Directive.
FourToSeven::one of
4 5 6 7
flags: [noStrict]
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
function invalid() { "\7"; "use strict"; }

View File

@ -0,0 +1,26 @@
// Copyright (C) 2020 Rick Waldron Inc. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-additional-syntax-string-literals
description: >
String Literals extensions disallowed in strict mode; NonOctalDecimalEscapeSequence 8
info: |
It is possible for string literals to precede a Use Strict Directive that places the enclosing
code in strict mode, and implementations must take care to not use this extended definition of
EscapeSequence with such literals. For example, attempting to parse the following source text
must fail.
Strict mode is entered via the explicit Use Strict Directive.
NonOctalDecimalEscapeSequence::one of
8 9
flags: [noStrict]
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
function invalid() { "\8"; "use strict"; }

View File

@ -0,0 +1,26 @@
// Copyright (C) 2020 Rick Waldron Inc. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-additional-syntax-string-literals
description: >
String Literals extensions disallowed in strict mode; NonOctalDecimalEscapeSequence 9
info: |
It is possible for string literals to precede a Use Strict Directive that places the enclosing
code in strict mode, and implementations must take care to not use this extended definition of
EscapeSequence with such literals. For example, attempting to parse the following source text
must fail.
Strict mode is entered via the explicit Use Strict Directive.
NonOctalDecimalEscapeSequence::one of
8 9
flags: [noStrict]
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
function invalid() { "\9"; "use strict"; }