1 /* -*- Mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4 -*- */
2 /* vi: set ts=4 sw=4 expandtab: (add to ~/.vimrc: set modeline modelines=5) */
3 /* ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
16 * The Original Code is [Open Source Virtual Machine.].
18 * The Initial Developer of the Original Code is
19 * Adobe System Incorporated.
20 * Portions created by the Initial Developer are Copyright (C) 2008
21 * the Initial Developer. All Rights Reserved.
26 * Alternatively, the contents of this file may be used under the terms of
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
38 * ***** END LICENSE BLOCK ***** */
40 print
(eval
("print('hello, nested world'); 37"))
41 print
("hello, world");
43 print
({ "foo": 10, bar
: 20 });
44 print
({ "foo": 10, bar
: 20 }.foo
);
45 print
({ "foo": 10, bar
: 20 }.bar
);
46 print
(["a","b",,"c",,].length
); // should be 5
47 print
(["a","b",,"c",,]);
55 function g
() { print
("holy smokes, batman!"); }
65 for ( var i
=0 ; i
< 10 ; i
++ )
70 function g
() { var w
= "inner"; }
76 function h
() { print
("first"); }
78 function h
() { print
("second"); }
80 function zappa
(x
, y
) { return x
+ y
; }
81 print
(zappa
("hello", "there"));
86 print
(obj
.toString
());
87 print
(obj
["toString"]());
88 print
(new Array(1,2,3));
90 return "" + this.x
+ "," + this.y
96 c
.prototype
= { y
: 20 };
98 var zz
= function (x
) { return x
}
100 var uu
= "nothing special"
101 var yy
= function uu
(x
) { return x
}
105 var obj
= ["a","b","c"]
108 for ( var i
=17 in [] )
111 for ( var i
=17 in obj
)
112 print
(i
+ "," + obj
[i
]);
116 print
("Should happen");
119 print
("Should not happen");
124 print
("Should not happen");
127 print
("Should happen with foo: " + e
);
151 for each ( var i
in [1,2,3])
154 include "smoketest2.as";
155 include "smoketest2.as"
157 function typed1
(x
: int): void {
158 var v
: String = "foo";
162 print
("hello".split
("ll"));
174 for ( x
=0 ; x
< 1 ; x
++ )
175 for each ( i
in [1,2,3] )
178 var object
= { fun
: function() { return this.valueOf
(); }, valueOf
: function () { return this.value
}, value
: 37 };
183 function f
() { return a
}
189 print
(1.7976931348623145e308
);
190 print
(Number.MAX_VALUE
);
196 print
(/\u0041/.exec
("A").length
);
201 function g
() { return this }
207 print
(eval
("function () { broken broken broken"));
212 print
(parseInt
(341, 8).toString
(16));
213 var f
= function (x
) { print
(arguments); return arguments.callee
; }
216 function container
() {
217 var v
= function () { print
("hello"); }
218 v
.toString
= Object.prototype
.toString
;
223 function rest
(x
, ...rest
) {
232 <name
>John Smith
</name
>
235 <description
>Big
Screen Television
</description
>
236 <price
>1299.99</price
>
239 <description
>DVD Player
</description
>
240 <price
>399.99</price
>
245 var xml7
= <><c q
='1'>"quotes"</c
><c q
='2'>{
;curly brackets
}
;</c
></>;
249 <employee id
="0"><fname
>John
</fname
><age
>20</age
></employee
>
250 <employee id
="1"><fname
>Sue
</fname
><age
>30</age
></employee
>
254 correct
= <employee id
="0"><fname
>John
</fname
><age
>20</age
></employee
>;
256 john
= e
.employee
.(fname
== "John");
261 <alpha attr1
="value1" attr2
="value2">
264 <charlie
>two
</charlie
>
272 // fast switches - this code triggers fast switch generation on 2009-03-03, at least.
273 // would be good to verify that it continues to do so...
275 // output should be 5 4 4 again default 2 1 2 0
277 for ( var i
=5 ; i
>= 0 ; i
-- ) {
279 case 0: print
("0"); break;
280 case 1: print
("1"); // no break
281 case 2: print
("2"); break;
282 case 1: print
("3"); break;
284 print
("4 again"); break;
285 case 5: print
("5"); break;
286 default: print
("default"); break;
290 // -- Nothing new beyond this line! ----------------------------------------------------------
293 print
("SMOKETEST DONE!");