~ubuntu-branches/ubuntu/saucy/mozjs17/saucy

« back to all changes in this revision

Viewing changes to js/src/tests/js1_5/Regress/regress-31255.js

  • Committer: Package Import Robot
  • Author(s): Rico Tzschichholz
  • Date: 2013-05-25 12:24:23 UTC
  • Revision ID: package-import@ubuntu.com-20130525122423-zmxucrhtensw90xy
Tags: upstream-17.0.0
ImportĀ upstreamĀ versionĀ 17.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 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 = [];
 
29
 
 
30
 
 
31
<!-- HTML comment start is already a single-line JS comment indicator
 
32
 var x = 1; <!-- until end-of-line
 
33
 
 
34
             status = inSection(1);
 
35
actual = (x == 1);
 
36
expect = true;
 
37
addThis();
 
38
 
 
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;
 
44
 
 
45
status = inSection(2);
 
46
actual = (x == 2);
 
47
expect = true;
 
48
addThis();
 
49
 
 
50
 
 
51
 
 
52
//-----------------------------------------------------------------------------
 
53
test();
 
54
//-----------------------------------------------------------------------------
 
55
 
 
56
 
 
57
 
 
58
function addThis()
 
59
{
 
60
  statusitems[UBound] = status;
 
61
  actualvalues[UBound] = actual;
 
62
  expectedvalues[UBound] = expect;
 
63
  UBound++;
 
64
}
 
65
 
 
66
 
 
67
function test()
 
68
{
 
69
  enterFunc('test');
 
70
  printBugNumber(BUGNUMBER);
 
71
  printStatus(summary);
 
72
 
 
73
  for (var i=0; i<UBound; i++)
 
74
  {
 
75
    reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
 
76
  }
 
77
 
 
78
  exitFunc ('test');
 
79
}