Ticket #13871: multi-line-html-close.js

File multi-line-html-close.js, 2.5 KB (added by WildKeccak, 6 years ago)

This comes from the zipball at https://bakkot.github.io/test262-web-runner/

Line 
1// Copyright (C) 2016 the V8 project authors. All rights reserved.
2// This code is governed by the BSD license found in the LICENSE file.
3/*---
4esid: sec-html-like-comments
5es6id: B1.3
6description: Optional HTMLCloseComment following MultiLineComment
7info: |
8 Comment ::
9 MultiLineComment
10 SingleLineComment
11 SingleLineHTMLOpenComment
12 SingleLineHTMLCloseComment
13 SingleLineDelimitedComment
14
15 MultiLineComment ::
16 /* FirstCommentLine[opt] LineTerminator MultiLineCommentChars[opt] * / HTMLCloseComment[opt]
17
18 HTMLCloseComment ::
19 WhiteSpaceSequence[opt] SingleLineDelimitedCommentSequence[opt] --> SingleLineCommentChars[opt]
20negative:
21 phase: runtime
22 type: Test262Error
23---*/
24
25var counter = 0;
26/*
27*/-->
28counter += 1;
29
30/*
31*/-->the comment extends to these characters
32counter += 1;
33
34/* optional FirstCommentLine
35*/-->the comment extends to these characters
36counter += 1;
37
38/*
39optional
40MultiLineCommentChars */-->the comment extends to these characters
41counter += 1;
42
43/*
44*/ /* optional SingleLineDelimitedCommentSequence */-->the comment extends to these characters
45counter += 1;
46
47/*
48*/ /**/ /* second optional SingleLineDelimitedCommentSequence */-->the comment extends to these characters
49counter += 1;
50
51// The V8 engine exhibited a bug where HTMLCloseComment was not recognized
52// within MultiLineComment in cases where MultiLineComment was not the first
53// token on the line of source text. The following tests demonstrate the same
54// productions listed above with the addition of such a leading token.
55
560/*
57*/-->
58counter += 1;
59
600/*
61*/-->the comment extends to these characters
62counter += 1;
63
640/* optional FirstCommentLine
65*/-->the comment extends to these characters
66counter += 1;
67
680/*
69optional
70MultiLineCommentChars */-->the comment extends to these characters
71counter += 1;
72
730/*
74*/ /* optional SingleLineDelimitedCommentSequence */-->the comment extends to these characters
75counter += 1;
76
770/*
78*/ /**/ /* second optional SingleLineDelimitedCommentSequence */-->the comment extends to these characters
79counter += 1;
80
81// Because this test concerns the interpretation of non-executable character
82// sequences within ECMAScript source code, special care must be taken to
83// ensure that executable code is evaluated as expected.
84//
85// Express the intended behavior by intentionally throwing an error; this
86// guarantees that test runners will only consider the test "passing" if
87// executable sequences are correctly interpreted as such.
88if (counter === 12) {
89 throw new Test262Error();
90}