jscript: Added Array constructor implementation.
[wine] / dlls / jscript / tests / api.js
1 /*
2  * Copyright 2008 Jacek Caban for CodeWeavers
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 var arr = new Array();
20 ok(typeof(arr) === "object", "arr () is not object");
21 ok(arr["0"] === undefined, "arr[0] is not undefined");
22
23 var arr = new Array(1, 2, "test");
24 ok(typeof(arr) === "object", "arr (1,2,test) is not object");
25 ok(arr["0"] === 1, "arr[0] is not 1");
26 ok(arr["1"] === 2, "arr[1] is not 2");
27 ok(arr["2"] === "test", "arr[2] is not \"test\"");
28
29 var arr = new Array(6);
30 ok(typeof(arr) === "object", "arr (6) is not object");
31 ok(arr["0"] === undefined, "arr[0] is not undefined");
32
33 reportSuccess();