mirror of
https://github.com/tc39/test262.git
synced 2025-07-23 22:15:24 +02:00
Apply review feedback for hashbang
This commit is contained in:
parent
da8ef2e779
commit
353cf531d6
@ -7,6 +7,10 @@
|
|||||||
#
|
#
|
||||||
# https://github.com/tc39/process-document
|
# https://github.com/tc39/process-document
|
||||||
|
|
||||||
|
# Hashbang Grammar
|
||||||
|
# https://github.com/tc39/proposal-hashbang
|
||||||
|
hashbang
|
||||||
|
|
||||||
# Object.fromEntries
|
# Object.fromEntries
|
||||||
# https://github.com/tc39/proposal-object-from-entries
|
# https://github.com/tc39/proposal-object-from-entries
|
||||||
Object.fromEntries
|
Object.fromEntries
|
||||||
|
14
test/language/comments/hashbang/encoded-bang-041.js
Normal file
14
test/language/comments/hashbang/encoded-bang-041.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#\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]
|
||||||
|
---*/
|
@ -2,9 +2,13 @@
|
|||||||
/*---
|
/*---
|
||||||
esid: pending
|
esid: pending
|
||||||
description: >
|
description: >
|
||||||
Hashbang comments should not be allowed to have encoded characters
|
Hashbang comments should not be allowed to have encoded characters \u0021
|
||||||
info: |
|
info: |
|
||||||
HashbangComment::
|
HashbangComment::
|
||||||
#! SingleLineCommentChars[opt]
|
#! SingleLineCommentChars[opt]
|
||||||
flags: [raw]
|
flags: [raw]
|
||||||
|
negative:
|
||||||
|
phase: parse
|
||||||
|
type: SyntaxError
|
||||||
|
features: [hashbang]
|
||||||
---*/
|
---*/
|
14
test/language/comments/hashbang/encoded-bang-u21.js
Normal file
14
test/language/comments/hashbang/encoded-bang-u21.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#\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]
|
||||||
|
---*/
|
14
test/language/comments/hashbang/encoded-bang-x21.js
Normal file
14
test/language/comments/hashbang/encoded-bang-x21.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#\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]
|
||||||
|
---*/
|
14
test/language/comments/hashbang/encoded-hash-043.js
Normal file
14
test/language/comments/hashbang/encoded-hash-043.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
\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]
|
||||||
|
---*/
|
@ -2,9 +2,13 @@
|
|||||||
/*---
|
/*---
|
||||||
esid: pending
|
esid: pending
|
||||||
description: >
|
description: >
|
||||||
Hashbang comments should not be allowed to have encoded characters
|
Hashbang comments should not be allowed to have encoded characters \u0023
|
||||||
info: |
|
info: |
|
||||||
HashbangComment::
|
HashbangComment::
|
||||||
#! SingleLineCommentChars[opt]
|
#! SingleLineCommentChars[opt]
|
||||||
flags: [raw]
|
flags: [raw]
|
||||||
|
negative:
|
||||||
|
phase: parse
|
||||||
|
type: SyntaxError
|
||||||
|
features: [hashbang]
|
||||||
---*/
|
---*/
|
14
test/language/comments/hashbang/encoded-hash-u23.js
Normal file
14
test/language/comments/hashbang/encoded-hash-u23.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
\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]
|
||||||
|
---*/
|
14
test/language/comments/hashbang/encoded-hash-x23.js
Normal file
14
test/language/comments/hashbang/encoded-hash-x23.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
\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]
|
||||||
|
---*/
|
@ -7,4 +7,8 @@ info: |
|
|||||||
HashbangComment::
|
HashbangComment::
|
||||||
#! SingleLineCommentChars[opt]
|
#! SingleLineCommentChars[opt]
|
||||||
flags: [raw]
|
flags: [raw]
|
||||||
|
negative:
|
||||||
|
phase: parse
|
||||||
|
type: SyntaxError
|
||||||
|
features: [hashbang]
|
||||||
---*/
|
---*/
|
@ -5,6 +5,9 @@ description: >
|
|||||||
info: |
|
info: |
|
||||||
HashbangComment::
|
HashbangComment::
|
||||||
#! SingleLineCommentChars[opt]
|
#! SingleLineCommentChars[opt]
|
||||||
|
features: [hashbang]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
assert.sameValue(eval('#!\n'), undefined);
|
assert.sameValue(eval('#!\n'), undefined);
|
||||||
|
assert.sameValue(eval('#!\n1'), 1)
|
||||||
|
assert.sameValue(eval('#!2\n'), undefined);
|
@ -9,6 +9,10 @@ flags: [raw]
|
|||||||
negative:
|
negative:
|
||||||
phase: parse
|
phase: parse
|
||||||
type: SyntaxError
|
type: SyntaxError
|
||||||
|
features: [hashbang]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
DONOTEVALUATE();
|
||||||
|
|
||||||
function fn() {#!
|
function fn() {#!
|
||||||
}
|
}
|
@ -5,11 +5,12 @@ description: >
|
|||||||
info: |
|
info: |
|
||||||
HashbangComment::
|
HashbangComment::
|
||||||
#! SingleLineCommentChars[opt]
|
#! SingleLineCommentChars[opt]
|
||||||
|
features: [hashbang]
|
||||||
---*/
|
---*/
|
||||||
const AsyncFunction = (async function (){}).constructor;
|
const AsyncFunction = (async function (){}).constructor;
|
||||||
const GeneratorFunction = (function *(){}).constructor;
|
const GeneratorFunction = (function *(){}).constructor;
|
||||||
const AsyncGeneratorFunction = (async function *(){}).constructor;
|
const AsyncGeneratorFunction = (async function *(){}).constructor;
|
||||||
for (ctor of [
|
for (const ctor of [
|
||||||
Function,
|
Function,
|
||||||
AsyncFunction,
|
AsyncFunction,
|
||||||
GeneratorFunction,
|
GeneratorFunction,
|
@ -7,4 +7,5 @@ info: |
|
|||||||
HashbangComment::
|
HashbangComment::
|
||||||
#! SingleLineCommentChars[opt]
|
#! SingleLineCommentChars[opt]
|
||||||
flags: [module]
|
flags: [module]
|
||||||
|
features: [hashbang]
|
||||||
---*/
|
---*/
|
@ -1,4 +1,5 @@
|
|||||||
#!/*
|
#!/*
|
||||||
|
DONOTEVALUATE();
|
||||||
these characters should not be considered within a comment
|
these characters should not be considered within a comment
|
||||||
*/
|
*/
|
||||||
/*---
|
/*---
|
||||||
@ -12,4 +13,5 @@ flags: [raw]
|
|||||||
negative:
|
negative:
|
||||||
phase: parse
|
phase: parse
|
||||||
type: SyntaxError
|
type: SyntaxError
|
||||||
|
features: [hashbang]
|
||||||
---*/
|
---*/
|
@ -6,6 +6,7 @@ info: |
|
|||||||
HashbangComment::
|
HashbangComment::
|
||||||
#! SingleLineCommentChars[opt]
|
#! SingleLineCommentChars[opt]
|
||||||
flags: [raw]
|
flags: [raw]
|
||||||
|
features: [hashbang]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
eval('#!');
|
assert.sameValue(eval('#!'), undefined);
|
@ -7,5 +7,6 @@ info: |
|
|||||||
HashbangComment::
|
HashbangComment::
|
||||||
#! SingleLineCommentChars[opt]
|
#! SingleLineCommentChars[opt]
|
||||||
flags: [raw]
|
flags: [raw]
|
||||||
|
features: [hashbang]
|
||||||
---*/
|
---*/
|
||||||
|
|
@ -0,0 +1,15 @@
|
|||||||
|
"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]
|
||||||
|
---*/
|
@ -11,4 +11,5 @@ flags: [raw]
|
|||||||
negative:
|
negative:
|
||||||
phase: parse
|
phase: parse
|
||||||
type: SyntaxError
|
type: SyntaxError
|
||||||
|
features: [hashbang]
|
||||||
---*/
|
---*/
|
@ -10,4 +10,5 @@ flags: [raw]
|
|||||||
negative:
|
negative:
|
||||||
phase: parse
|
phase: parse
|
||||||
type: SyntaxError
|
type: SyntaxError
|
||||||
|
features: [hashbang]
|
||||||
---*/
|
---*/
|
@ -11,4 +11,5 @@ flags: [raw]
|
|||||||
negative:
|
negative:
|
||||||
phase: parse
|
phase: parse
|
||||||
type: SyntaxError
|
type: SyntaxError
|
||||||
|
features: [hashbang]
|
||||||
---*/
|
---*/
|
@ -11,4 +11,5 @@ flags: [raw]
|
|||||||
negative:
|
negative:
|
||||||
phase: parse
|
phase: parse
|
||||||
type: SyntaxError
|
type: SyntaxError
|
||||||
|
features: [hashbang]
|
||||||
---*/
|
---*/
|
@ -11,4 +11,5 @@ flags: [raw]
|
|||||||
negative:
|
negative:
|
||||||
phase: parse
|
phase: parse
|
||||||
type: SyntaxError
|
type: SyntaxError
|
||||||
|
features: [hashbang]
|
||||||
---*/
|
---*/
|
@ -1,4 +1,4 @@
|
|||||||
#!
|
#!
|
||||||
/*---
|
/*---
|
||||||
esid: pending
|
esid: pending
|
||||||
description: >
|
description: >
|
||||||
@ -10,4 +10,5 @@ flags: [raw]
|
|||||||
negative:
|
negative:
|
||||||
phase: parse
|
phase: parse
|
||||||
type: SyntaxError
|
type: SyntaxError
|
||||||
|
features: [hashbang]
|
||||||
---*/
|
---*/
|
@ -9,6 +9,7 @@ flags: [raw]
|
|||||||
negative:
|
negative:
|
||||||
phase: parse
|
phase: parse
|
||||||
type: SyntaxError
|
type: SyntaxError
|
||||||
|
features: [hashbang]
|
||||||
---*/
|
---*/
|
||||||
{
|
{
|
||||||
#!
|
#!
|
@ -2,11 +2,12 @@
|
|||||||
/*---
|
/*---
|
||||||
esid: pending
|
esid: pending
|
||||||
description: >
|
description: >
|
||||||
Hashbang comments should not be interpretted and should not generate DirectivePrologues.
|
Hashbang comments should not be interpreted and should not generate DirectivePrologues.
|
||||||
info: |
|
info: |
|
||||||
HashbangComment::
|
HashbangComment::
|
||||||
#! SingleLineCommentChars[opt]
|
#! SingleLineCommentChars[opt]
|
||||||
flags: [raw]
|
flags: [raw]
|
||||||
|
features: [hashbang]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
with ({}) {}
|
with ({}) {}
|
Loading…
x
Reference in New Issue
Block a user