blob: 8085783925361857f78ea576d4597a44a3006f08 (
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Evaluate the production ObjectLiteral: { PropertyName : AssignmentExpression }
*
* @path ch11/11.1/11.1.5/S11.1.5_A2.js
* @description Creating property "prop" of various types(boolean, number and etc.)
*/
//CHECK#1
var x = true;
var object = {prop : x};
if (object.prop !== x) {
$ERROR('#1: var x = true; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));
}
//CHECK#2
var x = new Boolean(true);
var object = {prop : x};
if (object.prop !== x) {
$ERROR('#2: var x = new Boolean(true); var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));
}
//CHECK#3
var x = 1;
var object = {prop : x};
if (object.prop !== x) {
$ERROR('#3: var x = 1; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));
}
//CHECK#4
var x = new Number(1);
var object = {prop : x};
if (object.prop !== x) {
$ERROR('#4: var x = new Number(1); var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));
}
//CHECK#5
var x = "1";
var object = {prop : x};
if (object.prop !== x) {
$ERROR('#5: var x = "1"; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));
}
//CHECK#6
var x = new String(1);
var object = {prop : x};
if (object.prop !== x) {
$ERROR('#6: var x = new String(1); var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));
}
//CHECK#7
var x = undefined;
var object = {prop : x};
if (object.prop !== x) {
$ERROR('#7: var x = undefined; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));
}
//CHECK#8
var x = null;
var object = {prop : x};
if (object.prop !== x) {
$ERROR('#8: var x = null; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));
}
//CHECK#9
var x = {};
var object = {prop : x};
if (object.prop !== x) {
$ERROR('#9: var x = {}; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));
}
//CHECK#10
var x = [1,2];
var object = {prop : x};
if (object.prop !== x) {
$ERROR('#10: var x = [1,2]; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));
}
//CHECK#11
var x = function() {};
var object = {prop : x};
if (object.prop !== x) {
$ERROR('#11: var x = function() {}; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));
}
//CHECK#12
var x = this;
var object = {prop : x};
if (object.prop !== x) {
$ERROR('#12: var x = this; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));
}
|