1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 for (var p in x) array.push(p);
56 assertEquals(1, o1_1.x, "1");
58 assertEquals(1, o1_1.x, "2");
59 assertArrayEquals(["x"], props(o1_1), "3");
60 assertArrayEquals(["x"], props(o1_2), "4");
64 assertArrayEquals(["x"], props(o2_1));
65 assertArrayEquals(["x"], props(o2_2));
69 assertArrayEquals(["x", "y", "z"], props(o3_1));
70 assertArrayEquals(["x", "y", "z"], props(o3_2));
74 assertArrayEquals(["x", "y", "z"], props(o4_0_1));
75 assertArrayEquals(["x", "y", "z"], props(o4_0_2));
79 assertArrayEquals(["x", "y"], props(o4_1_1));
80 assertArrayEquals(["x", "y"], props(o4_1_2));
92 function f7(x, y, z) {
97 function testArgs(fun) {
99 assertArrayEquals(["x", "y"], props(obj));
100 assertEquals(void 0, obj.x);
101 assertEquals(void 0, obj.y);
104 assertArrayEquals(["x", "y"], props(obj));
105 assertEquals("x", obj.x);
106 assertEquals(void 0, obj.y);
108 obj = new fun("x", "y");
109 assertArrayEquals(["x", "y"], props(obj));
110 assertEquals("x", obj.x);
111 assertEquals("y", obj.y);
113 obj = new fun("x", "y", "z");
114 assertArrayEquals(["x", "y"], props(obj));
115 assertEquals("x", obj.x);
116 assertEquals("y", obj.y);
119 for (var i = 0; i < 10; i++) {
130 assertEquals(1, o.x);
132 assertEquals(1, o.x);
135 assertEquals(1, o.x);
136 assertEquals(2, o.y);
138 assertEquals(1, o.x);
139 assertEquals(2, o.y);