Debian Codegraph @

rhino/testsrc/tests/js1_5/Regress/regress-31255.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 /*
7 *
8 * Date: 09 November 2002
9 * SUMMARY: JS should treat --> as a single-line comment indicator.
10 * Whitespace may occur before the --> on the same line.
11 *
12 * See http://bugzilla.mozilla.org/show_bug.cgi?id=31255
13 * and http://bugzilla.mozilla.org/show_bug.cgi?id=179366 (Rhino version)
14 *
15 * Note: <!--, --> are the HTML multi-line comment opener, closer.
16 * JS already accepted <!-- as a single-line comment indicator.
17 *
18 */
19 //-----------------------------------------------------------------------------
20 var gTestfile = 'regress-31255.js';
21 var UBound = 0;
22 var BUGNUMBER = 31255;
23 var summary = 'JS should treat --> as a single-line comment indicator';
24 var status = '';
25 var statusitems = [];
26 var actual = '';
27 var actualvalues = [];
28 var expect= '';
29 var expectedvalues = [];
30
31
32 <!-- HTML comment start is already a single-line JS comment indicator
33 var x = 1; <!-- until end-of-line
34
35 status = inSection(1);
36 actual = (x == 1);
37 expect = true;
38 addThis();
39
40 --> HTML comment end is JS comments until end-of-line
41 --> but only if it follows a possible whitespace after line start
42 --> so in the following --> should not be treated as comments
43 if (x-->0)
44 x = 2;
45
46 status = inSection(2);
47 actual = (x == 2);
48 expect = true;
49 addThis();
50
51
52
53 //-----------------------------------------------------------------------------
54 test();
55 //-----------------------------------------------------------------------------
56
57
58
59 function addThis()
60 {
61 statusitems[UBound] = status;
62 actualvalues[UBound] = actual;
63 expectedvalues[UBound] = expect;
64 UBound++;
65 }
66
67
68 function test()
69 {
70 enterFunc('test');
71 printBugNumber(BUGNUMBER);
72 printStatus(summary);
73
74 for (var i=0; i<UBound; i++)
75 {
76 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
77 }
78
79 exitFunc ('test');
80 }