-
Notifications
You must be signed in to change notification settings - Fork 465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hashbang tests update #2065
Merged
Hashbang tests update #2065
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d628f9c
Add tests for Hashbang comments
bfarias-godaddy 02899e6
Apply review feedback for hashbang
leobalter ef9aaa8
Relax lint check for licensing in files
leobalter 4a88000
Final lint fix on tests
leobalter b5bd7e1
Tests with the raw flag can't use $DONOTEVALUATE();
leobalter b79d8ef
Linter should require direct throw statement for raw tests instead of…
leobalter 2fc79d4
Document raw negative test reqs
leobalter 0084c7c
Apply review feedback
leobalter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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,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."; |
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,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."; |
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,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."; |
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,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."; |
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,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."; |
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,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."; |
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,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."; |
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,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."; |
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,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."; |
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 be available in Script evaluator contexts. | ||
info: | | ||
HashbangComment:: | ||
#! SingleLineCommentChars[opt] | ||
features: [hashbang] | ||
---*/ | ||
|
||
assert.sameValue(eval('#!\n'), undefined); | ||
assert.sameValue(eval('#!\n1'), 1) | ||
assert.sameValue(eval('#!2\n'), undefined); | ||
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,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() {#! | ||
} |
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,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`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: missing space after comma |
||
assert.throws(SyntaxError, () => ctor('#!\n_'), `${ctor.name} Call body`); | ||
assert.throws(SyntaxError, () => new ctor('#!\n_',''), `${ctor.name} Construct argument`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: missing space after comma |
||
assert.throws(SyntaxError, () => new ctor('#!\n_'), `${ctor.name} Construct body`); | ||
} |
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 @@ | ||
#! | ||
/*--- | ||
esid: pending | ||
description: > | ||
Hashbang comments should be allowed in Modules. | ||
info: | | ||
HashbangComment:: | ||
#! SingleLineCommentChars[opt] | ||
flags: [module, raw] | ||
features: [hashbang] | ||
---*/ |
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,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] | ||
---*/ |
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 @@ | ||
/*--- | ||
esid: pending | ||
description: > | ||
Hashbang comments should not require a newline afterwards | ||
info: | | ||
HashbangComment:: | ||
#! SingleLineCommentChars[opt] | ||
features: [hashbang] | ||
---*/ | ||
|
||
assert.sameValue(eval('#!'), undefined); |
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 @@ | ||
#! 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] | ||
---*/ |
17 changes: 17 additions & 0 deletions
17
test/language/comments/hashbang/preceding-directive-prologue-sc.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,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."; |
17 changes: 17 additions & 0 deletions
17
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,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."; |
16 changes: 16 additions & 0 deletions
16
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,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."; |
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,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."; |
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,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."; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let’s try both direct and indirect
eval
.