js/src/tests/js1_5/Regress/regress-31255.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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/. */
     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 UBound = 0;
    21 var BUGNUMBER = 31255;
    22 var summary = 'JS should treat --> as a single-line comment indicator';
    23 var status = '';
    24 var statusitems = [];
    25 var actual = '';
    26 var actualvalues = [];
    27 var expect= '';
    28 var expectedvalues = [];
    31 <!-- HTML comment start is already a single-line JS comment indicator
    32  var x = 1; <!-- until end-of-line
    34 	     status = inSection(1);
    35 actual = (x == 1);
    36 expect = true;
    37 addThis();
    39 --> HTML comment end is JS comments until end-of-line
    40 --> but only if it follows a possible whitespace after line start
    41 --> so in the following --> should not be treated as comments
    42 if (x-->0)
    43   x = 2;
    45 status = inSection(2);
    46 actual = (x == 2);
    47 expect = true;
    48 addThis();
    52 //-----------------------------------------------------------------------------
    53 test();
    54 //-----------------------------------------------------------------------------
    58 function addThis()
    59 {
    60   statusitems[UBound] = status;
    61   actualvalues[UBound] = actual;
    62   expectedvalues[UBound] = expect;
    63   UBound++;
    64 }
    67 function test()
    68 {
    69   enterFunc('test');
    70   printBugNumber(BUGNUMBER);
    71   printStatus(summary);
    73   for (var i=0; i<UBound; i++)
    74   {
    75     reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
    76   }
    78   exitFunc ('test');
    79 }

mercurial