mirror of
https://github.com/tc39/test262.git
synced 2025-04-08 19:35:28 +02:00
Add tests for Annex B extns to comments (#612)
This commit is contained in:
parent
bace781a5b
commit
db8ff7cc01
58
test/annexB/language/comments/multi-line-html-close.js
Normal file
58
test/annexB/language/comments/multi-line-html-close.js
Normal file
@ -0,0 +1,58 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-html-like-comments
|
||||
es6id: B1.3
|
||||
description: Optional HTMLCloseComment following MultiLineComment
|
||||
info: |
|
||||
Comment ::
|
||||
MultiLineComment
|
||||
SingleLineComment
|
||||
SingleLineHTMLOpenComment
|
||||
SingleLineHTMLCloseComment
|
||||
SingleLineDelimitedComment
|
||||
|
||||
MultiLineComment ::
|
||||
/* FirstCommentLine[opt] LineTerminator MultiLineCommentChars[opt] * / HTMLCloseComment[opt]
|
||||
|
||||
HTMLCloseComment ::
|
||||
WhiteSpaceSequence[opt] SingleLineDelimitedCommentSequence[opt] --> SingleLineCommentChars[opt]
|
||||
negative: Test262Error
|
||||
---*/
|
||||
|
||||
var counter = 0;
|
||||
/*
|
||||
*/-->
|
||||
counter += 1;
|
||||
|
||||
/*
|
||||
*/-->the comment extends to these characters
|
||||
counter += 1;
|
||||
|
||||
/* optional FirstCommentLine
|
||||
*/-->the comment extends to these characters
|
||||
counter += 1;
|
||||
|
||||
/*
|
||||
optional
|
||||
MultiLineCommentChars */-->the comment extends to these characters
|
||||
counter += 1;
|
||||
|
||||
/*
|
||||
*/ /* optional SingleLineDelimitedCommentSequence */-->the comment extends to these characters
|
||||
counter += 1;
|
||||
|
||||
/*
|
||||
*/ /**/ /* second optional SingleLineDelimitedCommentSequence */-->the comment extends to these characters
|
||||
counter += 1;
|
||||
|
||||
// Because this test concerns the interpretation of non-executable character
|
||||
// sequences within ECMAScript source code, special care must be taken to
|
||||
// ensure that executable code is evaluated as expected.
|
||||
//
|
||||
// Express the intended behavior by intentionally throwing an error; this
|
||||
// guarantees that test runners will only consider the test "passing" if
|
||||
// executable sequences are correctly interpreted as such.
|
||||
if (counter === 6) {
|
||||
throw new Test262Error();
|
||||
}
|
37
test/annexB/language/comments/single-line-html-close-asi.js
Normal file
37
test/annexB/language/comments/single-line-html-close-asi.js
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-html-like-comments
|
||||
es6id: B1.3
|
||||
description: >
|
||||
A SingleLineHTMLCloseComment is considered to be a LineTerminator for
|
||||
purposes of parsing by the syntactic grammar.
|
||||
info: |
|
||||
Comment ::
|
||||
MultiLineComment
|
||||
SingleLineComment
|
||||
SingleLineHTMLOpenComment
|
||||
SingleLineHTMLCloseComment
|
||||
SingleLineDelimitedComment
|
||||
|
||||
MultiLineComment ::
|
||||
/* FirstCommentLine[opt] LineTerminator MultiLineCommentChars[opt] * / HTMLCloseComment[opt]
|
||||
|
||||
HTMLCloseComment ::
|
||||
WhiteSpaceSequence[opt] SingleLineDelimitedCommentSequence[opt] --> SingleLineCommentChars[opt]
|
||||
negative: Test262Error
|
||||
---*/
|
||||
|
||||
var foo = [23]
|
||||
-->[0];
|
||||
|
||||
// Because this test concerns the interpretation of non-executable character
|
||||
// sequences within ECMAScript source code, special care must be taken to
|
||||
// ensure that executable code is evaluated as expected.
|
||||
//
|
||||
// Express the intended behavior by intentionally throwing an error; this
|
||||
// guarantees that test runners will only consider the test "passing" if
|
||||
// executable sequences are correctly interpreted as such.
|
||||
if (foo[0] === 23) {
|
||||
throw new Test262Error();
|
||||
}
|
48
test/annexB/language/comments/single-line-html-close.js
Normal file
48
test/annexB/language/comments/single-line-html-close.js
Normal file
@ -0,0 +1,48 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-html-like-comments
|
||||
es6id: B1.3
|
||||
description: SingleLineHTMLCloseComment
|
||||
info: |
|
||||
Comment ::
|
||||
MultiLineComment
|
||||
SingleLineComment
|
||||
SingleLineHTMLOpenComment
|
||||
SingleLineHTMLCloseComment
|
||||
SingleLineDelimitedComment
|
||||
|
||||
SingleLineHTMLCloseComment ::
|
||||
LineTerminatorSequenceHTMLCloseComment
|
||||
|
||||
HTMLCloseComment ::
|
||||
WhiteSpaceSequence[opt] SingleLineDelimitedCommentSequence[opt] --> SingleLineCommentChars[opt]
|
||||
negative: Test262Error
|
||||
---*/
|
||||
|
||||
var counter = 0;
|
||||
-->
|
||||
counter += 1;
|
||||
|
||||
-->the comment extends to these characters
|
||||
counter += 1;
|
||||
|
||||
-->the comment extends to these characters
|
||||
counter += 1;
|
||||
|
||||
/* optional SingleLineDelimitedCommentSequence */-->the comment extends to these characters
|
||||
counter += 1;
|
||||
|
||||
/**/ /* second optional SingleLineDelimitedCommentSequence */-->the comment extends to these characters
|
||||
counter += 1;
|
||||
|
||||
// Because this test concerns the interpretation of non-executable character
|
||||
// sequences within ECMAScript source code, special care must be taken to
|
||||
// ensure that executable code is evaluated as expected.
|
||||
//
|
||||
// Express the intended behavior by intentionally throwing an error; this
|
||||
// guarantees that test runners will only consider the test "passing" if
|
||||
// executable sequences are correctly interpreted as such.
|
||||
if (counter === 5) {
|
||||
throw new Test262Error();
|
||||
}
|
42
test/annexB/language/comments/single-line-html-open.js
Normal file
42
test/annexB/language/comments/single-line-html-open.js
Normal file
@ -0,0 +1,42 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-html-like-comments
|
||||
es6id: B1.3
|
||||
description: SingleLineHTMLOpenComment
|
||||
info: |
|
||||
Comment ::
|
||||
MultiLineComment
|
||||
SingleLineComment
|
||||
SingleLineHTMLOpenComment
|
||||
SingleLineHTMLCloseComment
|
||||
SingleLineDelimitedComment
|
||||
|
||||
SingleLineHTMLOpenComment ::
|
||||
<!--SingleLineCommentCharsopt
|
||||
negative: Test262Error
|
||||
---*/
|
||||
|
||||
var counter = 0;
|
||||
<!--
|
||||
counter += 1;
|
||||
|
||||
<!--the comment extends to these characters
|
||||
counter += 1;
|
||||
|
||||
counter += 1;<!--the comment extends to these characters
|
||||
counter += 1;
|
||||
|
||||
var x = 0;
|
||||
x = -1 <!--x;
|
||||
|
||||
// Because this test concerns the interpretation of non-executable character
|
||||
// sequences within ECMAScript source code, special care must be taken to
|
||||
// ensure that executable code is evaluated as expected.
|
||||
//
|
||||
// Express the intended behavior by intentionally throwing an error; this
|
||||
// guarantees that test runners will only consider the test "passing" if
|
||||
// executable sequences are correctly interpreted as such.
|
||||
if (counter === 4 && x === -1) {
|
||||
throw new Test262Error();
|
||||
}
|
22
test/language/comments/multi-line-html-close-extra.js
Normal file
22
test/language/comments/multi-line-html-close-extra.js
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-html-like-comments
|
||||
es6id: B1.3
|
||||
description: >
|
||||
Arbitrary character sequence not permitted before HTMLCloseComment token
|
||||
info: |
|
||||
Comment ::
|
||||
MultiLineComment
|
||||
SingleLineComment
|
||||
SingleLineHTMLOpenComment
|
||||
SingleLineHTMLCloseComment
|
||||
SingleLineDelimitedComment
|
||||
|
||||
MultiLineComment ::
|
||||
/* FirstCommentLine[opt] LineTerminator MultiLineCommentChars[opt] * / HTMLCloseComment[opt]
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
/*
|
||||
*/ the comment should not include these characters, regardless of AnnexB extensions -->
|
20
test/language/comments/single-line-html-close-without-lt.js
Normal file
20
test/language/comments/single-line-html-close-without-lt.js
Normal file
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-html-like-comments
|
||||
es6id: B1.3
|
||||
description: An HTMLCloseComment must be preceeded by a LineTerminator
|
||||
info: |
|
||||
Comment ::
|
||||
MultiLineComment
|
||||
SingleLineComment
|
||||
SingleLineHTMLOpenComment
|
||||
SingleLineHTMLCloseComment
|
||||
SingleLineDelimitedComment
|
||||
|
||||
HTMLCloseComment ::
|
||||
WhiteSpaceSequence[opt] SingleLineDelimitedCommentSequence[opt] --> SingleLineCommentChars[opt]
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
;-->
|
14
test/language/module-code/comment-multi-line-html-close.js
Normal file
14
test/language/module-code/comment-multi-line-html-close.js
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: >
|
||||
HTML-like comments are not available in module code
|
||||
(MultiLineHTMLCloseComment)
|
||||
esid: sec-html-like-comments
|
||||
es6id: B1.3
|
||||
negative: SyntaxError
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
/*
|
||||
*/-->
|
13
test/language/module-code/comment-single-line-html-close.js
Normal file
13
test/language/module-code/comment-single-line-html-close.js
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: >
|
||||
HTML-like comments are not available in module code
|
||||
(SingleLineHTMLCloseComment)
|
||||
esid: sec-html-like-comments
|
||||
es6id: B1.3
|
||||
negative: SyntaxError
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
-->
|
13
test/language/module-code/comment-single-line-html-open.js
Normal file
13
test/language/module-code/comment-single-line-html-open.js
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: >
|
||||
HTML-like comments are not available in module code
|
||||
(SingleLineHTMLOpenComment)
|
||||
esid: sec-html-like-comments
|
||||
es6id: B1.3
|
||||
negative: SyntaxError
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
<!--
|
Loading…
x
Reference in New Issue
Block a user