single-line-html-close-unicode-separators.js (1928B)
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: SingleLineHTMLCloseComment 7 info: | 8 Comment :: 9 MultiLineComment 10 SingleLineComment 11 SingleLineHTMLOpenComment 12 SingleLineHTMLCloseComment 13 SingleLineDelimitedComment 14 15 SingleLineHTMLCloseComment :: 16 LineTerminatorSequenceHTMLCloseComment 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 // DANGER WILL ROBINSON! 28 // 29 // There are UTF-8-encoded Unicode separators in the lines below. Some text 30 // editors (notably including, in the experience of this test's author, the 31 // GNOME Text Editor used to attempt to create this file) don't properly insert 32 // and save both these characters. (It seemed to handle copy/pasting U+2028 33 // LINE SEPARATOR from GNOME Character Map just fine, but U+2029 PARAGRAPH 34 // SEPARATOR got mangled in the final saved file.) Be extremely careful editing 35 // this file to not inadvertently break this test. 36 37 counter -->a U+2028 LINE SEPARATOR between "counter" and "-->" means this is all a comment 38 counter += 1; 39 40 counter -->a U+2029 PARAGRAPH SEPARATOR between "counter" and "-->" means this is all a comment 41 counter += 1; 42 43 // Because this test concerns the interpretation of non-executable character 44 // sequences within ECMAScript source code, special care must be taken to 45 // ensure that executable code is evaluated as expected. 46 // 47 // Express the intended behavior by intentionally throwing an error; this 48 // guarantees that test runners will only consider the test "passing" if 49 // executable sequences are correctly interpreted as such. 50 if (counter === 2) { 51 throw new Test262Error(); 52 }