~saviq/ubuntu/saucy/qtdeclarative-opensource-src/add-qtquick-delegate-range

« back to all changes in this revision

Viewing changes to tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-188206-02.js

  • Committer: Package Import Robot
  • Author(s): Timo Jyrinki
  • Date: 2013-02-05 14:17:19 UTC
  • Revision ID: package-import@ubuntu.com-20130205141719-qqeyml8wslpyez52
Tags: upstream-5.0.1
ImportĀ upstreamĀ versionĀ 5.0.1

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
/* ***** BEGIN LICENSE BLOCK *****
 
3
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 
4
 *
 
5
 * The contents of this file are subject to the Mozilla Public License Version
 
6
 * 1.1 (the "License"); you may not use this file except in compliance with
 
7
 * the License. You may obtain a copy of the License at
 
8
 * http://www.mozilla.org/MPL/
 
9
 *
 
10
 * Software distributed under the License is distributed on an "AS IS" basis,
 
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 
12
 * for the specific language governing rights and limitations under the
 
13
 * License.
 
14
 *
 
15
 * The Original Code is JavaScript Engine testing utilities.
 
16
 *
 
17
 * The Initial Developer of the Original Code is
 
18
 * Netscape Communications Corp.
 
19
 * Portions created by the Initial Developer are Copyright (C) 2003
 
20
 * the Initial Developer. All Rights Reserved.
 
21
 *
 
22
 * Contributor(s):
 
23
 *   scole@planetweb.com, pschwartau@netscape.com
 
24
 *
 
25
 * Alternatively, the contents of this file may be used under the terms of
 
26
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 
27
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 
28
 * in which case the provisions of the GPL or the LGPL are applicable instead
 
29
 * of those above. If you wish to allow use of your version of this file only
 
30
 * under the terms of either the GPL or the LGPL, and not to allow others to
 
31
 * use your version of this file under the terms of the MPL, indicate your
 
32
 * decision by deleting the provisions above and replace them with the notice
 
33
 * and other provisions required by the GPL or the LGPL. If you do not delete
 
34
 * the provisions above, a recipient may use your version of this file under
 
35
 * the terms of any one of the MPL, the GPL or the LGPL.
 
36
 *
 
37
 * ***** END LICENSE BLOCK ***** */
 
38
 
 
39
//-----------------------------------------------------------------------------
 
40
var gTestfile = 'regress-188206-02.js';
 
41
var UBound = 0;
 
42
var BUGNUMBER = 188206;
 
43
var summary = 'Invalid use of regexp quantifiers should generate SyntaxErrors';
 
44
var CHECK_PASSED = 'Should not generate an error';
 
45
var CHECK_FAILED = 'Generated an error!';
 
46
var status = '';
 
47
var statusitems = [];
 
48
var actual = '';
 
49
var actualvalues = [];
 
50
var expect= '';
 
51
var expectedvalues = [];
 
52
 
 
53
 
 
54
/*
 
55
 * Misusing the {DecmalDigits} quantifier - according to ECMA,
 
56
 * but not according to Perl.
 
57
 *
 
58
 * ECMA-262 Edition 3 prohibits the use of unescaped braces in
 
59
 * regexp patterns, unless they form part of a quantifier.
 
60
 *
 
61
 * Hovever, Perl does not prohibit this. If not used as part
 
62
 * of a quantifer, Perl treats braces literally.
 
63
 *
 
64
 * We decided to follow Perl on this for backward compatibility.
 
65
 * See http://bugzilla.mozilla.org/show_bug.cgi?id=190685.
 
66
 *
 
67
 * Therefore NONE of the following ECMA violations should generate
 
68
 * a SyntaxError. Note we use checkThis() instead of testThis().
 
69
 */
 
70
status = inSection(13);
 
71
checkThis(' /a*{/ ');
 
72
 
 
73
status = inSection(14);
 
74
checkThis(' /a{}/ ');
 
75
 
 
76
status = inSection(15);
 
77
checkThis(' /{a/ ');
 
78
 
 
79
status = inSection(16);
 
80
checkThis(' /}a/ ');
 
81
 
 
82
status = inSection(17);
 
83
checkThis(' /x{abc}/ ');
 
84
 
 
85
status = inSection(18);
 
86
checkThis(' /{{0}/ ');
 
87
 
 
88
status = inSection(19);
 
89
checkThis(' /{{1}/ ');
 
90
 
 
91
status = inSection(20);
 
92
checkThis(' /x{{0}/ ');
 
93
 
 
94
status = inSection(21);
 
95
checkThis(' /x{{1}/ ');
 
96
 
 
97
status = inSection(22);
 
98
checkThis(' /x{{0}}/ ');
 
99
 
 
100
status = inSection(23);
 
101
checkThis(' /x{{1}}/ ');
 
102
 
 
103
status = inSection(24);
 
104
checkThis(' /x{{0}}/ ');
 
105
 
 
106
status = inSection(25);
 
107
checkThis(' /x{{1}}/ ');
 
108
 
 
109
status = inSection(26);
 
110
checkThis(' /x{{0}}/ ');
 
111
 
 
112
status = inSection(27);
 
113
checkThis(' /x{{1}}/ ');
 
114
 
 
115
 
 
116
//-----------------------------------------------------------------------------
 
117
test();
 
118
//-----------------------------------------------------------------------------
 
119
 
 
120
 
 
121
 
 
122
/*
 
123
 * Allowed syntax shouldn't generate any errors
 
124
 */
 
125
function checkThis(sAllowedSyntax)
 
126
{
 
127
  expect = CHECK_PASSED;
 
128
  actual = CHECK_PASSED;
 
129
 
 
130
  try
 
131
  {
 
132
    eval(sAllowedSyntax);
 
133
  }
 
134
  catch(e)
 
135
  {
 
136
    actual = CHECK_FAILED;
 
137
  }
 
138
 
 
139
  statusitems[UBound] = status;
 
140
  expectedvalues[UBound] = expect;
 
141
  actualvalues[UBound] = actual;
 
142
  UBound++;
 
143
}
 
144
 
 
145
 
 
146
function test()
 
147
{
 
148
  enterFunc('test');
 
149
  printBugNumber(BUGNUMBER);
 
150
  printStatus(summary);
 
151
 
 
152
  for (var i=0; i<UBound; i++)
 
153
  {
 
154
    reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
 
155
  }
 
156
 
 
157
  exitFunc ('test');
 
158
}