Debian Codegraph @

js/src/tests/test262/annexB/language/comments/multi-line-html-close.js

raw
1 // |reftest| error:Test262Error
2 // Copyright (C) 2016 the V8 project authors. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 esid: sec-html-like-comments
6 description: Optional HTMLCloseComment following MultiLineComment
7 info: |
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]
20 negative:
21 phase: runtime
22 type: Test262Error
23 ---*/
24
25 var counter = 0;
26 /*
27 */-->
28 counter += 1;
29
30 /*
31 */-->the comment extends to these characters
32 counter += 1;
33
34 /* optional FirstCommentLine
35 */-->the comment extends to these characters
36 counter += 1;
37
38 /*
39 optional
40 MultiLineCommentChars */-->the comment extends to these characters
41 counter += 1;
42
43 /*
44 */ /* optional SingleLineDelimitedCommentSequence */-->the comment extends to these characters
45 counter += 1;
46
47 /*
48 */ /**/ /* second optional SingleLineDelimitedCommentSequence */-->the comment extends to these characters
49 counter += 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
56 0/*
57 */-->
58 counter += 1;
59
60 0/*
61 */-->the comment extends to these characters
62 counter += 1;
63
64 0/* optional FirstCommentLine
65 */-->the comment extends to these characters
66 counter += 1;
67
68 0/*
69 optional
70 MultiLineCommentChars */-->the comment extends to these characters
71 counter += 1;
72
73 0/*
74 */ /* optional SingleLineDelimitedCommentSequence */-->the comment extends to these characters
75 counter += 1;
76
77 0/*
78 */ /**/ /* second optional SingleLineDelimitedCommentSequence */-->the comment extends to these characters
79 counter += 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.
88 if (counter === 12) {
89 throw new Test262Error();
90 }