Bug 469739 - Add support for displaying Vista UAC shield icon; r=joe sr=vladimir
[wine-gecko.git] / js / tests / js1_5 / Regress / regress-321874.js
blob02f454fd15055638a73e3f5044407dc23b5d6941
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
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/
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.
15 * The Original Code is JavaScript Engine testing utilities.
17 * The Initial Developer of the Original Code is
18 * Mozilla Foundation.
19 * Portions created by the Initial Developer are Copyright (C) 2006
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s): Yuh-Ruey Chen
23 * Brendan Eich
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.
37 * ***** END LICENSE BLOCK ***** */
39 var gTestfile = 'regress-321874.js';
40 //-----------------------------------------------------------------------------
41 var BUGNUMBER = 321874;
42 var summary = 'lhs must be a reference in (for lhs in rhs) ...';
43 var actual = '';
44 var expect = '';
45 var section;
47 printBugNumber(BUGNUMBER);
48 printStatus (summary);
50 function a() {}
51 var b = {foo: 'bar'};
53 printStatus('for-in tests');
55 var v;
56 section = summary + ': for((v) in b);';
57 expect = 'foo';
58 printStatus(section);
59 try
61 eval('for ((v) in b);');
62 actual = v;
64 catch(ex)
66 printStatus(ex+'');
67 actual = 'error';
69 reportCompare(expect, actual, section);
71 section = summary + ': function foo(){for((v) in b);};foo();';
72 expect = 'foo';
73 printStatus(section);
74 try
76 eval('function foo(){ for ((v) in b);}; foo();');
77 actual = v;
79 catch(ex)
81 printStatus(ex+'');
82 actual = 'error';
84 reportCompare(expect, actual, section);
86 section = summary + ': for(a() in b);';
87 expect = 'error';
88 printStatus(section);
89 try
91 eval('for (a() in b);');
92 actual = 'no error';
94 catch(ex)
96 printStatus(ex+'');
97 actual = 'error';
99 reportCompare(expect, actual, section);
101 section = summary + ': function foo(){for(a() in b);};foo();';
102 expect = 'error';
103 printStatus(section);
106 eval('function foo(){ for (a() in b);};foo();');
107 actual = 'no error';
109 catch(ex)
111 printStatus(ex+'');
112 actual = 'error';
114 reportCompare(expect, actual, section);
116 section = ': for(new a() in b);';
117 expect = 'error';
118 printStatus(section);
121 eval('for (new a() in b);');
122 actual = 'no error';
124 catch(ex)
126 printStatus(ex+'');
127 actual = 'error';
129 reportCompare(expect, actual, summary + section);
131 section = ': function foo(){for(new a() in b);};foo();';
132 expect = 'error';
133 printStatus(section);
136 eval('function foo(){ for (new a() in b);};foo();');
137 actual = 'no error';
139 catch(ex)
141 printStatus(ex+'');
142 actual = 'error';
144 reportCompare(expect, actual, summary + section);
146 section = ': for(void in b);';
147 expect = 'error';
148 printStatus(section);
151 eval('for (void in b);');
152 actual = 'no error';
154 catch(ex)
156 printStatus(ex+'');
157 actual = 'error';
159 reportCompare(expect, actual, summary + section);
161 section = ': function foo(){for(void in b);};foo();';
162 expect = 'error';
163 printStatus(section);
166 eval('function foo(){ for (void in b);};foo();');
167 actual = 'no error';
169 catch(ex)
171 printStatus(ex+'');
172 actual = 'error';
174 reportCompare(expect, actual, summary + section);
176 var d = 1;
177 var e = 2;
178 expect = 'error';
179 section = ': for((d*e) in b);';
180 printStatus(section);
183 eval('for ((d*e) in b);');
184 actual = 'no error';
186 catch(ex)
188 printStatus(ex+'');
189 actual = 'error';
191 reportCompare(expect, actual, summary + section);
193 var d = 1;
194 var e = 2;
195 expect = 'error';
196 section = ': function foo(){for((d*e) in b);};foo();';
197 printStatus(section);
200 eval('function foo(){ for ((d*e) in b);};foo();');
201 actual = 'no error';
203 catch(ex)
205 printStatus(ex+'');
206 actual = 'error';
208 reportCompare(expect, actual, summary + section);
210 const c = 0;
211 expect = 0;
212 section = ': for(c in b);';
213 printStatus(section);
216 eval('for (c in b);');
217 actual = c;
218 printStatus('typeof c: ' + (typeof c) + ', c: ' + c);
220 catch(ex)
222 printStatus(ex+'');
223 actual = 'error';
225 reportCompare(expect, actual, summary + section);
227 expect = 0;
228 section = ': function foo(){for(c in b);};foo();';
229 printStatus(section);
232 eval('function foo(){ for (c in b);};foo();');
233 actual = c;
234 printStatus('typeof c: ' + (typeof c) + ', c: ' + c);
236 catch(ex)
238 printStatus(ex+'');
239 actual = 'error';
241 reportCompare(expect, actual, summary + section);
243 if (typeof it != 'undefined')
245 printStatus('Shell tests: it.item() can return a reference type');
247 expect = 'foo';
248 section = ': for(it.item(0) in b);';
249 printStatus(section);
252 eval('for (it.item(0) in b);');
253 actual = it.item(0);
255 catch(ex)
257 printStatus(ex+'');
258 actual = 'error';
260 reportCompare(expect, actual, summary + section);
262 expect = 'foo';
263 section = ': function foo(){for(it.item(0) in b);};foo();';
264 printStatus(section);
267 eval('function foo(){ for (it.item(0) in b);};foo();');
268 actual = it.item(0);
270 catch(ex)
272 printStatus(ex+'');
273 actual = 'error';
275 reportCompare(expect, actual, summary + section);