OLD | NEW |
1 description("Test to ensure correct behaviour of Object.getOwnPropertyDescriptor
"); | 1 description("Test to ensure correct behaviour of Object.getOwnPropertyDescriptor
"); |
2 | 2 |
3 function descriptorShouldBe(object, property, expected) { | 3 function descriptorShouldBe(object, property, expected) { |
4 var test = 'Object.getOwnPropertyDescriptor('+object+", "+property+')'; | 4 var test = 'Object.getOwnPropertyDescriptor('+object+", "+property+')'; |
5 if ("writable" in expected) { | 5 if ("writable" in expected) { |
6 // shouldBe(test+'.writable', '' + expected.writable); | 6 // shouldBe(test+'.writable', '' + expected.writable); |
7 shouldBe(test+'.value', '' + expected.value); | 7 shouldBe(test+'.value', '' + expected.value); |
8 shouldBeFalse(test+".hasOwnProperty('get')"); | 8 shouldBeFalse(test+".hasOwnProperty('get')"); |
9 shouldBeFalse(test+".hasOwnProperty('set')"); | 9 shouldBeFalse(test+".hasOwnProperty('set')"); |
10 } else { | 10 } else { |
11 shouldBe(test+'.get', '' + expected.get); | 11 shouldBe(test+'.get', '' + expected.get); |
12 shouldBe(test+'.set', '' + expected.set); | 12 shouldBe(test+'.set', '' + expected.set); |
13 shouldBeFalse(test+".hasOwnProperty('value')"); | 13 shouldBeFalse(test+".hasOwnProperty('value')"); |
14 shouldBeFalse(test+".hasOwnProperty('writable')"); | 14 shouldBeFalse(test+".hasOwnProperty('writable')"); |
15 } | 15 } |
16 shouldBe(test+'.enumerable', '' + expected.enumerable); | 16 shouldBe(test+'.enumerable', '' + expected.enumerable); |
17 shouldBe(test+'.configurable', '' + expected.configurable); | 17 shouldBe(test+'.configurable', '' + expected.configurable); |
18 } | 18 } |
19 | 19 |
20 shouldBeUndefined("Object.getOwnPropertyDescriptor({}, 'undefinedProperty')"); | 20 shouldBeUndefined("Object.getOwnPropertyDescriptor({}, 'undefinedProperty')"); |
21 descriptorShouldBe("{definedProperty:'defined'}", "'definedProperty'", {writable
: true, enumerable: true, configurable: true, value:'"defined"'}); | 21 descriptorShouldBe("{definedProperty:'defined'}", "'definedProperty'", {writable
: true, enumerable: true, configurable: true, value:'"defined"'}); |
22 descriptorShouldBe("Array.prototype", "'concat'", {writable: true, enumerable: f
alse, configurable: true, value:"Array.prototype.concat"}); | 22 descriptorShouldBe("Array.prototype", "'concat'", {writable: true, enumerable: f
alse, configurable: true, value:"Array.prototype.concat"}); |
23 descriptorShouldBe("Date.prototype", "'toISOString'", {writable: true, enumerabl
e: false, configurable: true, value: "Date.prototype.toISOString"}); | 23 descriptorShouldBe("Date.prototype", "'toISOString'", {writable: true, enumerabl
e: false, configurable: true, value: "Date.prototype.toISOString"}); |
24 descriptorShouldBe("String.prototype", "'concat'", {writable: true, enumerable:
false, configurable: true, value:"String.prototype.concat"}); | 24 descriptorShouldBe("String.prototype", "'concat'", {writable: true, enumerable:
false, configurable: true, value:"String.prototype.concat"}); |
25 descriptorShouldBe("RegExp.prototype", "'exec'", {writable: true, enumerable: fa
lse, configurable: true, value:"RegExp.prototype.exec"}); | 25 descriptorShouldBe("RegExp.prototype", "'exec'", {writable: true, enumerable: fa
lse, configurable: true, value:"RegExp.prototype.exec"}); |
26 descriptorShouldBe("document.__proto__.__proto__", "'createElement'", {writable:
true, enumerable: true, configurable: false, value:"document.createElement"}); | 26 descriptorShouldBe("document.__proto__.__proto__", "'createElement'", {writable:
true, enumerable: true, configurable: true, value:"document.createElement"}); |
| 27 descriptorShouldBe("window", "'location'", {writable: false, enumerable: true, c
onfigurable: false, value: "window.location"}); |
27 descriptorShouldBe("Number", "'NEGATIVE_INFINITY'", {writable: false, enumerable
: false, configurable: false, value:"Number.NEGATIVE_INFINITY"}); | 28 descriptorShouldBe("Number", "'NEGATIVE_INFINITY'", {writable: false, enumerable
: false, configurable: false, value:"Number.NEGATIVE_INFINITY"}); |
28 descriptorShouldBe("RegExp", "'$_'", {writable: true, enumerable: false, configu
rable: true, value:"RegExp.$_"}); | 29 descriptorShouldBe("RegExp", "'$_'", {writable: true, enumerable: false, configu
rable: true, value:"RegExp.$_"}); |
29 descriptorShouldBe("/a/g", "'global'", {writable: true, enumerable: false, confi
gurable: false, value:true}); | 30 descriptorShouldBe("/a/g", "'global'", {writable: true, enumerable: false, confi
gurable: false, value:true}); |
30 descriptorShouldBe("Node", "'DOCUMENT_POSITION_DISCONNECTED'", {writable: false,
enumerable: true, configurable: false, value:"Node.DOCUMENT_POSITION_DISCONNECT
ED"}); | 31 descriptorShouldBe("Node", "'DOCUMENT_POSITION_DISCONNECTED'", {writable: false,
enumerable: true, configurable: false, value:"Node.DOCUMENT_POSITION_DISCONNECT
ED"}); |
31 descriptorShouldBe("Math", "'sin'", {writable: true, enumerable: false, configur
able: true, value:"Math.sin"}); | 32 descriptorShouldBe("Math", "'sin'", {writable: true, enumerable: false, configur
able: true, value:"Math.sin"}); |
32 descriptorShouldBe("[1,2,3]", "0", {writable: true, enumerable: true, configurab
le: true, value:"1"}); | 33 descriptorShouldBe("[1,2,3]", "0", {writable: true, enumerable: true, configurab
le: true, value:"1"}); |
33 descriptorShouldBe("[1,2,3]", "'length'", {writable: true, enumerable: false, co
nfigurable: false, value:"3"}); | 34 descriptorShouldBe("[1,2,3]", "'length'", {writable: true, enumerable: false, co
nfigurable: false, value:"3"}); |
34 descriptorShouldBe("[1,2,3]", "'length'", {writable: true, enumerable: false, co
nfigurable: false, value:"3"}); | 35 descriptorShouldBe("[1,2,3]", "'length'", {writable: true, enumerable: false, co
nfigurable: false, value:"3"}); |
35 descriptorShouldBe("/(a)*/g.exec('a')", "0", {writable: true, enumerable: true,
configurable: true, value:"'a'"}); | 36 descriptorShouldBe("/(a)*/g.exec('a')", "0", {writable: true, enumerable: true,
configurable: true, value:"'a'"}); |
36 descriptorShouldBe("/(a)*/g.exec('a')", "'length'", {writable: true, enumerable:
false, configurable: false, value:2}); | 37 descriptorShouldBe("/(a)*/g.exec('a')", "'length'", {writable: true, enumerable:
false, configurable: false, value:2}); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 shouldBe('property', normalOrder[i++]); | 84 shouldBe('property', normalOrder[i++]); |
84 i = 0; | 85 i = 0; |
85 for (var property in Object.getOwnPropertyDescriptor(objectWithGetter, "getter")
) | 86 for (var property in Object.getOwnPropertyDescriptor(objectWithGetter, "getter")
) |
86 shouldBe('property', accessorOrder[i++]); | 87 shouldBe('property', accessorOrder[i++]); |
87 i = 0; | 88 i = 0; |
88 for (var property in Object.getOwnPropertyDescriptor(objectWithSetter, "setter")
) | 89 for (var property in Object.getOwnPropertyDescriptor(objectWithSetter, "setter")
) |
89 shouldBe('property', accessorOrder[i++]); | 90 shouldBe('property', accessorOrder[i++]); |
90 i = 0; | 91 i = 0; |
91 for (var property in Object.getOwnPropertyDescriptor(objectWithAccessor, "access
or")) | 92 for (var property in Object.getOwnPropertyDescriptor(objectWithAccessor, "access
or")) |
92 shouldBe('property', accessorOrder[i++]); | 93 shouldBe('property', accessorOrder[i++]); |
OLD | NEW |