summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/ch08/8.6/S8.6_A4_T1.js
blob: 94424118af9fd8657f9aff0b06900a384aca1f9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/**
 * An Object is an unordered collection of properties
 *
 * @path ch08/8.6/S8.6_A4_T1.js
 * @description Simple using a few custom properties
 */

///////////////////////////////////////////////////////
// CHECK#1
var obj = {bar:true, some:1, foo:"a"};

var count=0;

for (property in obj)	count++;

if (count !== 3){
  $ERROR('#1: obj = {bar:true, some:1, foo:"a"}; count=0; for (property in obj) count++; count === 3. Actual: ' + (count));
}
//
////////////////////////////////////////////////////////

///////////////////////////////////////////////////////
// CHECK#2
var obj_ = {bar:true};
obj_.some = 1;
obj_.foo = "a";

count=0;

for (property in obj_) count++;

if (count !== 3){
  $ERROR('#2: obj_ = {bar:true}; obj_.some = 1; obj_.foo = "a"; count=0; for (property in obj_) count++; count === 3. Actual: ' + (count));
}
//
////////////////////////////////////////////////////////

///////////////////////////////////////////////////////
// CHECK#3
var obj__ = new Object();
obj__.bar = true;
obj__.some = 1;
obj__.foo = "a";

count=0;

for (property in obj__)	count++;

if (count !== 3){
  $ERROR('#3: obj__ = new Object(); obj__.bar = true; obj__.some = 1; obj__.foo = "a"; for (property in obj__)  count++; count === 3. Actual: ' + (count));
}
//
////////////////////////////////////////////////////////