Skip to content
Snippets Groups Projects
Commit da8ef2e7 authored by Bradley Farias's avatar Bradley Farias Committed by Rick Waldron
Browse files

Add tests for Hashbang comments

parent 33a306d1
No related branches found
No related tags found
No related merge requests found
Showing
with 232 additions and 0 deletions
#\u0021
/*---
esid: pending
description: >
Hashbang comments should not be allowed to have encoded characters
info: |
HashbangComment::
#! SingleLineCommentChars[opt]
flags: [raw]
---*/
\u0023!
/*---
esid: pending
description: >
Hashbang comments should not be allowed to have encoded characters
info: |
HashbangComment::
#! SingleLineCommentChars[opt]
flags: [raw]
---*/
\u0023\u0021
/*---
esid: pending
description: >
Hashbang comments should not be allowed to have encoded characters
info: |
HashbangComment::
#! SingleLineCommentChars[opt]
flags: [raw]
---*/
/*---
esid: pending
description: >
Hashbang comments should be available in Script evaluator contexts.
info: |
HashbangComment::
#! SingleLineCommentChars[opt]
---*/
assert.sameValue(eval('#!\n'), undefined);
/*---
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]
flags: [raw]
negative:
phase: parse
type: SyntaxError
---*/
function fn() {#!
}
/*---
esid: pending
description: >
Hashbang comments should not be allowed in function evaluator contexts.
info: |
HashbangComment::
#! SingleLineCommentChars[opt]
---*/
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_',''), `${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`);
}
#!
/*---
esid: pending
description: >
Hashbang comments should be allowed in Modules.
info: |
HashbangComment::
#! SingleLineCommentChars[opt]
flags: [module]
---*/
#!/*
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
---*/
\ No newline at end of file
/*---
esid: pending
description: >
Hashbang comments should not require a newline afterwards
info: |
HashbangComment::
#! SingleLineCommentChars[opt]
flags: [raw]
---*/
eval('#!');
#! 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]
---*/
"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
---*/
\ No newline at end of file
;#!
/*---
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
---*/
\ No newline at end of file
#!
#!
/*---
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
---*/
\ No newline at end of file
//
#!
/*---
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
---*/
\ No newline at end of file
/*
*/#!
/*---
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
---*/
\ No newline at end of file
#!
/*---
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
---*/
\ No newline at end of file
/*---
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]
flags: [raw]
negative:
phase: parse
type: SyntaxError
---*/
{
#!
}
\ No newline at end of file
#!"use strict"
/*---
esid: pending
description: >
Hashbang comments should not be interpretted and should not generate DirectivePrologues.
info: |
HashbangComment::
#! SingleLineCommentChars[opt]
flags: [raw]
---*/
with ({}) {}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment