-
Notifications
You must be signed in to change notification settings - Fork 460
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31e654a
commit 3ddcec6
Showing
14 changed files
with
186 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/*--- | ||
esid: pending | ||
description: > | ||
Hashbang comments should be available in Script evaluator contexts. | ||
info: | | ||
HashbangComment:: | ||
#! SingleLineCommentChars[opt] | ||
---*/ | ||
|
||
eval('#!\n'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/*--- | ||
esid: pending | ||
description: > | ||
Hashbang comments should not be allowed in function evaluator contexts. | ||
info: | | ||
HashbangComment:: | ||
#! SingleLineCommentChars[opt] | ||
flags: [module] | ||
---*/ | ||
const AsyncFunction = (async function (){}).constructor; | ||
const GeneratorFunction = (function *(){}).constructor; | ||
const AsyncGeneratorFunction = (async function *(){}).constructor; | ||
for (ctor of [ | ||
Function, | ||
AsyncFunction, | ||
GeneratorFunction, | ||
AsyncGeneratorFunction, | ||
]) { | ||
assert.throws(SyntaxError, () => ctor('#!\n_','')); | ||
assert.throws(SyntaxError, () => ctor('#!\n_')); | ||
assert.throws(SyntaxError, () => new ctor('#!\n_','')); | ||
assert.throws(SyntaxError, () => new ctor('#!\n_')); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#! | ||
/*--- | ||
esid: pending | ||
description: > | ||
Hashbang comments should be allowed in Modules. | ||
info: | | ||
HashbangComment:: | ||
#! SingleLineCommentChars[opt] | ||
flags: [module] | ||
---*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/* | ||
these characters should not be considered within a comment | ||
*/ | ||
/*--- | ||
esid: pending | ||
description: > | ||
Hashbang comments should not interpret multi-line comments. | ||
info: | | ||
HashbangComment:: | ||
#! SingleLineCommentChars[opt] | ||
negative: | ||
phase: parse | ||
type: SyntaxError | ||
---*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/*--- | ||
esid: pending | ||
description: > | ||
Hashbang comments should not require a newline afterwards | ||
info: | | ||
HashbangComment:: | ||
#! SingleLineCommentChars[opt] | ||
---*/ | ||
|
||
eval('#!'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#! 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] | ||
---*/ | ||
|
14 changes: 14 additions & 0 deletions
14
test/language/comments/hashbang-preceding-directive-prologue.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
"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] | ||
negative: | ||
phase: parse | ||
type: SyntaxError | ||
---*/ |
13 changes: 13 additions & 0 deletions
13
test/language/comments/hashbang-preceding-empty-statement.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
;#! | ||
/*--- | ||
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] | ||
negative: | ||
phase: parse | ||
type: SyntaxError | ||
---*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#! | ||
#! | ||
/*--- | ||
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] | ||
negative: | ||
phase: parse | ||
type: SyntaxError | ||
---*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
#! | ||
/*--- | ||
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] | ||
negative: | ||
phase: parse | ||
type: SyntaxError | ||
---*/ |
14 changes: 14 additions & 0 deletions
14
test/language/comments/hashbang-preceding-multi-line-comment.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
*/#! | ||
/*--- | ||
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] | ||
negative: | ||
phase: parse | ||
type: SyntaxError | ||
---*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/sh | ||
/*--- | ||
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] | ||
negative: | ||
phase: parse | ||
type: SyntaxError | ||
---*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/*--- | ||
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 | ||
---*/ | ||
{ | ||
#! | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!"use strict" | ||
/*--- | ||
esid: pending | ||
description: > | ||
Hashbang comments should not be interpretted and should not generate DirectivePrologues. | ||
info: | | ||
HashbangComment:: | ||
#! SingleLineCommentChars[opt] | ||
---*/ | ||
|
||
with ({}) {} |