tizen beta release
[profile/ivi/webkit-efl.git] / LayoutTests / fast / js / kde / script-tests / iteration.js
1 // 12.6.1
2 var count = 0;
3 do {
4   count++;
5 } while (count < 10);
6 shouldBe("count", "10");
7
8 count = 0;
9 for (var i = 0; i < 10; i++) {
10   if (i == 5)
11     break;
12   count++;
13 }
14 shouldBe("count", "5");
15
16 // 12.6.3
17 count = 0;
18 for (i = 0; i < 10; i++) {
19   count++;
20 }
21 shouldBe("count", "10");
22
23 // 12.6.4
24 obj = new Object();
25 obj.a = 11;
26 obj.b = 22;
27
28 properties = "";
29 for ( prop in obj )
30   properties += (prop + "=" + obj[prop] + ";");
31
32 shouldBe("properties", "'a=11;b=22;'");
33
34 // now a test verifying the order. not standardized but common.
35 obj.y = 33;
36 obj.x = 44;
37 properties = "";
38 for ( prop in obj )
39   properties += prop;
40 // shouldBe("properties", "'abyx'");
41
42 arr = new Array;
43 arr[0] = 100;
44 arr[1] = 101;
45 list = "";
46 for ( var j in arr ) {
47   list += "[" + j + "]=" + arr[j] + ";";
48 }
49 shouldBe("list","'[0]=100;[1]=101;'");
50
51 list = "";
52 for (var a = [1,2,3], length = a.length, i = 0; i < length; i++) {
53   list += a[i];
54 }
55 shouldBe("list", "'123'");