mirror of https://github.com/tc39/test262.git
Replace Object.hasOwnProperty.call with Object.prototype.hasOwnProperty.call
While we're at it, use assert() instead of assert.sameValue() for brevity, if we are not specifically testing that the return value of hasOwnProperty is the value true or false; and add more informative assertion messages to help with debugging. In some cases, the Object.hasOwnProperty.call could be replaced with verifyProperty(), if the property descriptor was also being verified at the same time. This fixes some tests that were faulty to begin with: a common mistake was Object.hasOwnProperty(obj, prop) which is probably going to return false when that's not what you want. The only instances left of `Object.hasOwnProperty` are one regression test in implementation-contributed which I can't tell if it was intentionally needed to trigger the regression, and a few instances of `Object.hasOwnProperty('prototype')` which would defeat the purpose to convert into `Object.prototype.hasOwnProperty.call(Object, 'prototype')` form. Closes: #3524
This commit is contained in:
parent
8609067d0c
commit
d87a7da6e1
|
@ -297,7 +297,7 @@ function TestKeyGet(obj) {
|
|||
function TestKeyHas(obj) {
|
||||
for (var i in symbols) {
|
||||
assertTrue(symbols[i] in obj)
|
||||
assertTrue(Object.hasOwnProperty.call(obj, symbols[i]))
|
||||
assertTrue(Object.prototype.hasOwnProperty.call(obj, symbols[i]))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ for (var constructor of arrayConstructors) {
|
|||
var x = { length: 2, 1: 5 };
|
||||
a.reverse.call(x);
|
||||
assertEquals(2, x.length);
|
||||
assertFalse(Object.hasOwnProperty(x, '1'));
|
||||
assertFalse(Object.prototype.hasOwnProperty.call(x, '1'));
|
||||
assertEquals(5, x[0]);
|
||||
}
|
||||
|
||||
|
|
|
@ -248,7 +248,7 @@ function TestKeyGet(obj) {
|
|||
function TestKeyHas() {
|
||||
for (var i in symbols) {
|
||||
assertTrue(symbols[i] in obj)
|
||||
assertTrue(Object.hasOwnProperty.call(obj, symbols[i]))
|
||||
assertTrue(Object.prototype.hasOwnProperty.call(obj, symbols[i]))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -611,7 +611,7 @@ x()();
|
|||
assertEquals(1, c.c()());
|
||||
assertEquals(1, c.d());
|
||||
assertEquals(1, c.e());
|
||||
assertFalse(Object.hasOwnProperty(c, 'a'));
|
||||
assertFalse(Object.prototype.hasOwnProperty.call(c, 'a'));
|
||||
assertEquals(c.a, c.e);
|
||||
assertEquals(undefined, c.f);
|
||||
}
|
||||
|
|
|
@ -32,9 +32,18 @@ class C {
|
|||
const c = new C();
|
||||
|
||||
// Test the private fields do not appear as properties before set to value
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")');
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
|
||||
"#gen does not appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "#gen"),
|
||||
"#gen does not appear as an own property on C constructor"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "#gen"),
|
||||
"#gen does not appear as an own property on C instance"
|
||||
);
|
||||
|
||||
var iter = c.gen();
|
||||
|
||||
|
@ -43,6 +52,15 @@ var iter = c.gen();
|
|||
assert.sameValue(callCount, 1);
|
||||
|
||||
// Test the private fields do not appear as properties after set to value
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")');
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
|
||||
"#gen does not appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "#gen"),
|
||||
"#gen does not appear as an own property on C constructor"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "#gen"),
|
||||
"#gen does not appear as an own property on C instance"
|
||||
);
|
||||
|
|
|
@ -30,8 +30,14 @@ class C {
|
|||
}
|
||||
|
||||
// Test the private fields do not appear as properties before set to value
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
|
||||
"#gen does not appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "#gen"),
|
||||
"#gen does not appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
var iter = C.gen();
|
||||
|
||||
|
@ -40,5 +46,11 @@ var iter = C.gen();
|
|||
assert.sameValue(callCount, 1);
|
||||
|
||||
// Test the private fields do not appear as properties after set to value
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
|
||||
"#gen does not appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "#gen"),
|
||||
"#gen does not appear as an own property on C constructor"
|
||||
);
|
||||
|
|
|
@ -32,9 +32,18 @@ var C = class {
|
|||
const c = new C();
|
||||
|
||||
// Test the private fields do not appear as properties before set to value
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")');
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
|
||||
"#gen does not appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "#gen"),
|
||||
"#gen does not appear as an own property on C constructor"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "#gen"),
|
||||
"#gen does not appear as an own property on C instance"
|
||||
);
|
||||
|
||||
var iter = c.gen();
|
||||
|
||||
|
@ -43,6 +52,15 @@ var iter = c.gen();
|
|||
assert.sameValue(callCount, 1);
|
||||
|
||||
// Test the private fields do not appear as properties after set to value
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")');
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
|
||||
"#gen does not appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "#gen"),
|
||||
"#gen does not appear as an own property on C constructor"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "#gen"),
|
||||
"#gen does not appear as an own property on C instance"
|
||||
);
|
||||
|
|
|
@ -30,8 +30,14 @@ var C = class {
|
|||
}
|
||||
|
||||
// Test the private fields do not appear as properties before set to value
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
|
||||
"#gen does not appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "#gen"),
|
||||
"#gen does not appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
var iter = C.gen();
|
||||
|
||||
|
@ -40,5 +46,11 @@ var iter = C.gen();
|
|||
assert.sameValue(callCount, 1);
|
||||
|
||||
// Test the private fields do not appear as properties after set to value
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
|
||||
"#gen does not appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "#gen"),
|
||||
"#gen does not appear as an own property on C constructor"
|
||||
);
|
||||
|
|
|
@ -45,5 +45,5 @@ item.then(({ done, value }) => {
|
|||
assert.sameValue(value.b, 2);
|
||||
assert.sameValue(value[s], 42);
|
||||
assert.sameValue(Object.keys(value).length, 5);
|
||||
assert(Object.hasOwnProperty.call(value, s));
|
||||
assert(Object.prototype.hasOwnProperty.call(value, s), "s is an own property");
|
||||
}).then($DONE, $DONE);
|
||||
|
|
|
@ -69,8 +69,14 @@ var obj3 = {
|
|||
//- assertions
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, s1), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, s1), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, s1),
|
||||
"s1 doesn't appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, s1),
|
||||
"s1 doesn't appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
verifyProperty(c, s1, {
|
||||
value: 42,
|
||||
|
@ -79,8 +85,14 @@ verifyProperty(c, s1, {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, s2), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, s2), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, s2),
|
||||
"s2 doesn't appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, s2),
|
||||
"s2 doesn't appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
verifyProperty(c, s2, {
|
||||
value: 43,
|
||||
|
@ -89,8 +101,14 @@ verifyProperty(c, s2, {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, s3), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, s3), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, s3),
|
||||
"s3 doesn't appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, s3),
|
||||
"s3 doesn't appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
verifyProperty(c, s3, {
|
||||
value: 44,
|
||||
|
|
|
@ -66,8 +66,14 @@ var obj3 = {
|
|||
//- assertions
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "d"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "d"),
|
||||
"d doesn't appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "d"),
|
||||
"d doesn't appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
verifyProperty(c, "d", {
|
||||
value: 42,
|
||||
|
@ -76,8 +82,14 @@ verifyProperty(c, "d", {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "e"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "e"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "e"),
|
||||
"e doesn't appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "e"),
|
||||
"e doesn't appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
verifyProperty(c, "e", {
|
||||
value: 43,
|
||||
|
@ -86,8 +98,14 @@ verifyProperty(c, "e", {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "f"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "f"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "f"),
|
||||
"f doesn't appear as an own property on C prototype"
|
||||
);
|
||||
assert(!
|
||||
Object.prototype.hasOwnProperty.call(C, "f"),
|
||||
"f doesn't appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
verifyProperty(c, "f", {
|
||||
value: 44,
|
||||
|
|
|
@ -25,8 +25,14 @@ var x = "b";
|
|||
[x] = 42; [10] = "meep"; ["not initialized"]
|
||||
//- assertions
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "b"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "b"),
|
||||
"b doesn't appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "b"),
|
||||
"b doesn't appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
verifyProperty(c, "b", {
|
||||
value: 42,
|
||||
|
@ -35,12 +41,27 @@ verifyProperty(c, "b", {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "x"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "x"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "x"),
|
||||
"x doesn't appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "x"),
|
||||
"x doesn't appear as an own property on C constructor"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "x"),
|
||||
"x doesn't appear as an own property on C instance"
|
||||
);
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "10"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "10"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "10"),
|
||||
"10 doesn't appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "10"),
|
||||
"10 doesn't appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
verifyProperty(c, "10", {
|
||||
value: "meep",
|
||||
|
@ -49,8 +70,14 @@ verifyProperty(c, "10", {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"),
|
||||
"'not initialized' doesn't appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "not initialized"),
|
||||
"'not initialized' doesn't appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
verifyProperty(c, "not initialized", {
|
||||
value: undefined,
|
||||
|
|
|
@ -25,8 +25,14 @@ var y = Symbol();
|
|||
//- elements
|
||||
[x]; [y] = 42
|
||||
//- assertions
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, x), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, x),
|
||||
"Symbol x doesn't appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, x),
|
||||
"Symbol x doesn't appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
verifyProperty(c, x, {
|
||||
value: undefined,
|
||||
|
@ -35,8 +41,14 @@ verifyProperty(c, x, {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, y), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, y),
|
||||
"Symbol y doesn't appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, y),
|
||||
"Symbol y doesn't appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
verifyProperty(c, y, {
|
||||
value: 42,
|
||||
|
@ -45,10 +57,28 @@ verifyProperty(c, y, {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "x"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "x"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "x"),
|
||||
"x doesn't appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "x"),
|
||||
"x doesn't appear as an own property on C constructor"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "x"),
|
||||
"x doesn't appear as an own property on C instance"
|
||||
);
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "y"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "y"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "y"),
|
||||
"y doesn't appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "y"),
|
||||
"y doesn't appear as an own property on C constructor"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "y"),
|
||||
"y doesn't appear as an own property on C instance"
|
||||
);
|
||||
|
|
|
@ -61,10 +61,22 @@ assert.sameValue(C.g, undefined);
|
|||
assert.sameValue(C.h, undefined);
|
||||
assert.sameValue(C[0], undefined);
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, 'f'), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, 'g'), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, 'h'), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, 0), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, 'f'),
|
||||
"f does not appear as an own property on C constructor"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, 'g'),
|
||||
"g does not appear as an own property on C constructor"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, 'h'),
|
||||
"h does not appear as an own property on C constructor"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, 0),
|
||||
"0 does not appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
verifyProperty(c, 'f', {
|
||||
value: 'test262',
|
||||
|
|
|
@ -20,9 +20,27 @@ $;
|
|||
//- assertions
|
||||
let c = new C();
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, 'accessor'), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, '$'), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, 'accessor'), true);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, '$'), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, 'accessor'), true);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, '$'), true);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, 'accessor'),
|
||||
"accessor doesn't appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, '$'),
|
||||
"$ doesn't appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
Object.prototype.hasOwnProperty.call(C, 'accessor'),
|
||||
"C constructor has an own property accessor"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, '$'),
|
||||
"$ doesn't appear as an own property on C constructor"
|
||||
);
|
||||
assert(
|
||||
Object.prototype.hasOwnProperty.call(c, 'accessor'),
|
||||
"C instance has an own property accessor"
|
||||
);
|
||||
assert(
|
||||
Object.prototype.hasOwnProperty.call(c, '$'),
|
||||
"C instance has an own property $"
|
||||
);
|
||||
|
|
|
@ -22,8 +22,14 @@ features: [class-fields-public]
|
|||
a
|
||||
b = 42;
|
||||
//- assertions
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "a"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "a"),
|
||||
"a doesn't appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "a"),
|
||||
"a doesn't appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
verifyProperty(c, "a", {
|
||||
value: undefined,
|
||||
|
@ -32,8 +38,14 @@ verifyProperty(c, "a", {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "b"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "b"),
|
||||
"b doesn't appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "b"),
|
||||
"b doesn't appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
verifyProperty(c, "b", {
|
||||
value: 42,
|
||||
|
|
|
@ -25,8 +25,14 @@ const fn = function() {}
|
|||
a; b = 42;
|
||||
c = fn
|
||||
//- assertions
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "a"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "a"),
|
||||
"a doesn't appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "a"),
|
||||
"a doesn't appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
verifyProperty(c, "a", {
|
||||
value: undefined,
|
||||
|
@ -35,8 +41,14 @@ verifyProperty(c, "a", {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "b"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "b"),
|
||||
"b doesn't appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "b"),
|
||||
"b doesn't appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
verifyProperty(c, "b", {
|
||||
value: 42,
|
||||
|
@ -45,8 +57,14 @@ verifyProperty(c, "b", {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "c"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "c"),
|
||||
"c doesn't appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "c"),
|
||||
"c doesn't appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
verifyProperty(c, "c", {
|
||||
value: fn,
|
||||
|
|
|
@ -35,18 +35,18 @@ y() {
|
|||
//- assertions
|
||||
|
||||
// Test the private fields do not appear as properties before set to value
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1");
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2");
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
|
||||
assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4");
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5");
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
|
||||
assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
|
||||
|
||||
// Test if private fields can be sucessfully accessed and set to value
|
||||
assert.sameValue(c.x(), 42, "test 7");
|
||||
assert.sameValue(c.y(), 43, "test 8");
|
||||
|
||||
// Test the private fields do not appear as properties before after set to value
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9");
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10");
|
||||
assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9");
|
||||
assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 10");
|
||||
|
|
|
@ -17,7 +17,10 @@ class C {
|
|||
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
assert.sameValue(c.m, C.prototype.m);
|
||||
|
||||
verifyProperty(C.prototype, "m", {
|
||||
|
|
|
@ -17,7 +17,10 @@ class C {
|
|||
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
assert.sameValue(c.m, C.prototype.m);
|
||||
|
||||
verifyProperty(C.prototype, "m", {
|
||||
|
|
|
@ -17,7 +17,10 @@ class C {
|
|||
var c = new C();
|
||||
|
||||
assert.sameValue(c.m().next().value, 42);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
assert.sameValue(c.m, C.prototype.m);
|
||||
|
||||
verifyProperty(C.prototype, "m", {
|
||||
|
|
|
@ -17,7 +17,10 @@ class C {
|
|||
var c = new C();
|
||||
|
||||
assert.sameValue(c.m(), 42);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
assert.sameValue(c.m, C.prototype.m);
|
||||
|
||||
verifyProperty(C.prototype, "m", {
|
||||
|
|
|
@ -17,8 +17,14 @@ class C {
|
|||
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "m"),
|
||||
"m doesn't appear as an own property on the C prototype"
|
||||
);
|
||||
|
||||
verifyProperty(C, "m", {
|
||||
enumerable: false,
|
||||
|
|
|
@ -17,8 +17,14 @@ class C {
|
|||
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "m"),
|
||||
"m doesn't appear as an own property on the C prototype"
|
||||
);
|
||||
|
||||
verifyProperty(C, "m", {
|
||||
enumerable: false,
|
||||
|
|
|
@ -17,8 +17,14 @@ class C {
|
|||
var c = new C();
|
||||
|
||||
assert.sameValue(C.m().next().value, 42);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "m"),
|
||||
"m doesn't appear as an own property on the C prototype"
|
||||
);
|
||||
|
||||
verifyProperty(C, "m", {
|
||||
enumerable: false,
|
||||
|
|
|
@ -17,8 +17,14 @@ class C {
|
|||
var c = new C();
|
||||
|
||||
assert.sameValue(C.m(), 42);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "m"),
|
||||
"m doesn't appear as an own property on the C prototype"
|
||||
);
|
||||
|
||||
verifyProperty(C, "m", {
|
||||
enumerable: false,
|
||||
|
|
|
@ -21,7 +21,10 @@ class C {
|
|||
var c = new C();
|
||||
|
||||
assert.sameValue(c.m(), 42);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
assert.sameValue(c.m, C.prototype.m);
|
||||
|
||||
verifyProperty(C.prototype, "m", {
|
||||
|
@ -31,7 +34,10 @@ verifyProperty(C.prototype, "m", {
|
|||
});
|
||||
|
||||
assert.sameValue(c.m2(), 39);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false);
|
||||
assert(!
|
||||
Object.prototype.hasOwnProperty.call(c, "m2"),
|
||||
"m2 doesn't appear as an own property on the C instance"
|
||||
);
|
||||
assert.sameValue(c.m2, C.prototype.m2);
|
||||
|
||||
verifyProperty(C.prototype, "m2", {
|
||||
|
@ -41,8 +47,14 @@ verifyProperty(C.prototype, "m2", {
|
|||
});
|
||||
|
||||
assert.sameValue(c.foo, "foobar");
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "foo"),
|
||||
"foo doesn't appear as an own property on the C constructor"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
|
||||
"foo doesn't appear as an own property on the C prototype"
|
||||
);
|
||||
|
||||
verifyProperty(c, "foo", {
|
||||
value: "foobar",
|
||||
|
@ -52,8 +64,14 @@ verifyProperty(c, "foo", {
|
|||
});
|
||||
|
||||
assert.sameValue(c.bar, "barbaz");
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "bar"),
|
||||
"bar doesn't appear as an own property on the C constructor"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
|
||||
"bar doesn't appear as an own property on the C prototype"
|
||||
);
|
||||
|
||||
verifyProperty(c, "bar", {
|
||||
value: "barbaz",
|
||||
|
|
|
@ -19,8 +19,14 @@ class C {
|
|||
var c = new C();
|
||||
|
||||
assert.sameValue(c.foo, "foobar");
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "foo"),
|
||||
"foo doesn't appear as an own property on the C constructor"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
|
||||
"foo doesn't appear as an own property on the C prototype"
|
||||
);
|
||||
|
||||
verifyProperty(c, "foo", {
|
||||
value: "foobar",
|
||||
|
@ -30,8 +36,14 @@ verifyProperty(c, "foo", {
|
|||
});
|
||||
|
||||
assert.sameValue(c.bar, "barbaz");
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "bar"),
|
||||
"bar doesn't appear as an own property on the C constructor"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
|
||||
"bar doesn't appear as an own property on the C prototype"
|
||||
);
|
||||
|
||||
verifyProperty(c, "bar", {
|
||||
value: "barbaz",
|
||||
|
|
|
@ -19,7 +19,10 @@ var c = new C();
|
|||
|
||||
assert.sameValue(c.m(), 42);
|
||||
assert.sameValue(c.m, C.prototype.m);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
|
||||
verifyProperty(C.prototype, "m", {
|
||||
enumerable: false,
|
||||
|
|
|
@ -19,7 +19,10 @@ var c = new C();
|
|||
|
||||
assert.sameValue(c.m().next().value, 42);
|
||||
assert.sameValue(c.m, C.prototype.m);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
|
||||
verifyProperty(C.prototype, "m", {
|
||||
enumerable: false,
|
||||
|
|
|
@ -19,7 +19,10 @@ var c = new C();
|
|||
|
||||
assert.sameValue(c.m(), 42);
|
||||
assert.sameValue(c.m, C.prototype.m);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
|
||||
verifyProperty(C.prototype, "m", {
|
||||
enumerable: false,
|
||||
|
|
|
@ -18,7 +18,10 @@ var c = new C();
|
|||
|
||||
assert.sameValue(c.m().next().value, 42);
|
||||
assert.sameValue(c.m, C.prototype.m);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
|
||||
verifyProperty(C.prototype, "m", {
|
||||
enumerable: false,
|
||||
|
|
|
@ -18,7 +18,10 @@ var c = new C();
|
|||
|
||||
assert.sameValue(c.m(), 42);
|
||||
assert.sameValue(c.m, C.prototype.m);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
|
||||
verifyProperty(C.prototype, "m", {
|
||||
enumerable: false,
|
||||
|
|
|
@ -17,7 +17,10 @@ var C = class {
|
|||
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
assert.sameValue(c.m, C.prototype.m);
|
||||
|
||||
verifyProperty(C.prototype, "m", {
|
||||
|
|
|
@ -17,7 +17,10 @@ var C = class {
|
|||
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
assert.sameValue(c.m, C.prototype.m);
|
||||
|
||||
verifyProperty(C.prototype, "m", {
|
||||
|
|
|
@ -17,7 +17,10 @@ var C = class {
|
|||
var c = new C();
|
||||
|
||||
assert.sameValue(c.m().next().value, 42);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
assert.sameValue(c.m, C.prototype.m);
|
||||
|
||||
verifyProperty(C.prototype, "m", {
|
||||
|
|
|
@ -17,7 +17,10 @@ var C = class {
|
|||
var c = new C();
|
||||
|
||||
assert.sameValue(c.m(), 42);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
assert.sameValue(c.m, C.prototype.m);
|
||||
|
||||
verifyProperty(C.prototype, "m", {
|
||||
|
|
|
@ -17,8 +17,14 @@ var C = class {
|
|||
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "m"),
|
||||
"m doesn't appear as an own property on the C prototype"
|
||||
);
|
||||
|
||||
verifyProperty(C, "m", {
|
||||
enumerable: false,
|
||||
|
|
|
@ -17,8 +17,14 @@ var C = class {
|
|||
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "m"),
|
||||
"m doesn't appear as an own property on the C prototype"
|
||||
);
|
||||
|
||||
verifyProperty(C, "m", {
|
||||
enumerable: false,
|
||||
|
|
|
@ -17,8 +17,14 @@ var C = class {
|
|||
var c = new C();
|
||||
|
||||
assert.sameValue(C.m().next().value, 42);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "m"),
|
||||
"m doesn't appear as an own property on the C prototype"
|
||||
);
|
||||
|
||||
verifyProperty(C, "m", {
|
||||
enumerable: false,
|
||||
|
|
|
@ -17,8 +17,14 @@ var C = class {
|
|||
var c = new C();
|
||||
|
||||
assert.sameValue(C.m(), 42);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "m"),
|
||||
"m doesn't appear as an own property on the C prototype"
|
||||
);
|
||||
|
||||
verifyProperty(C, "m", {
|
||||
enumerable: false,
|
||||
|
|
|
@ -21,7 +21,10 @@ var C = class {
|
|||
var c = new C();
|
||||
|
||||
assert.sameValue(c.m(), 42);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
assert.sameValue(c.m, C.prototype.m);
|
||||
|
||||
verifyProperty(C.prototype, "m", {
|
||||
|
@ -31,7 +34,10 @@ verifyProperty(C.prototype, "m", {
|
|||
});
|
||||
|
||||
assert.sameValue(c.m2(), 39);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m2"),
|
||||
"m2 doesn't appear as an own property on the C instance"
|
||||
);
|
||||
assert.sameValue(c.m2, C.prototype.m2);
|
||||
|
||||
verifyProperty(C.prototype, "m2", {
|
||||
|
@ -41,8 +47,14 @@ verifyProperty(C.prototype, "m2", {
|
|||
});
|
||||
|
||||
assert.sameValue(c.foo, "foobar");
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "foo"),
|
||||
"foo doesn't appear as an own property on the C constructor"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
|
||||
"foo doesn't appear as an own property on the C prototype"
|
||||
);
|
||||
|
||||
verifyProperty(c, "foo", {
|
||||
value: "foobar",
|
||||
|
@ -52,8 +64,14 @@ verifyProperty(c, "foo", {
|
|||
});
|
||||
|
||||
assert.sameValue(c.bar, "barbaz");
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "bar"),
|
||||
"bar doesn't appear as an own property on the C constructor"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
|
||||
"bar doesn't appear as an own property on the C prototype"
|
||||
);
|
||||
|
||||
verifyProperty(c, "bar", {
|
||||
value: "barbaz",
|
||||
|
|
|
@ -19,8 +19,14 @@ var C = class {
|
|||
var c = new C();
|
||||
|
||||
assert.sameValue(c.foo, "foobar");
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "foo"),
|
||||
"foo doesn't appear as an own property on the C constructor"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
|
||||
"foo doesn't appear as an own property on the C prototype"
|
||||
);
|
||||
|
||||
verifyProperty(c, "foo", {
|
||||
value: "foobar",
|
||||
|
@ -30,8 +36,14 @@ verifyProperty(c, "foo", {
|
|||
});
|
||||
|
||||
assert.sameValue(c.bar, "barbaz");
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "bar"),
|
||||
"bar doesn't appear as an own property on the C constructor"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
|
||||
"bar doesn't appear as an own property on the C prototype"
|
||||
);
|
||||
|
||||
verifyProperty(c, "bar", {
|
||||
value: "barbaz",
|
||||
|
|
|
@ -19,7 +19,10 @@ var c = new C();
|
|||
|
||||
assert.sameValue(c.m(), 42);
|
||||
assert.sameValue(c.m, C.prototype.m);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
|
||||
verifyProperty(C.prototype, "m", {
|
||||
enumerable: false,
|
||||
|
|
|
@ -19,7 +19,10 @@ var c = new C();
|
|||
|
||||
assert.sameValue(c.m().next().value, 42);
|
||||
assert.sameValue(c.m, C.prototype.m);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
|
||||
verifyProperty(C.prototype, "m", {
|
||||
enumerable: false,
|
||||
|
|
|
@ -19,7 +19,10 @@ var c = new C();
|
|||
|
||||
assert.sameValue(c.m(), 42);
|
||||
assert.sameValue(c.m, C.prototype.m);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
|
||||
verifyProperty(C.prototype, "m", {
|
||||
enumerable: false,
|
||||
|
|
|
@ -18,7 +18,10 @@ var c = new C();
|
|||
|
||||
assert.sameValue(c.m().next().value, 42);
|
||||
assert.sameValue(c.m, C.prototype.m);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
|
||||
verifyProperty(C.prototype, "m", {
|
||||
enumerable: false,
|
||||
|
|
|
@ -18,7 +18,10 @@ var c = new C();
|
|||
|
||||
assert.sameValue(c.m(), 42);
|
||||
assert.sameValue(c.m, C.prototype.m);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "m"),
|
||||
"m doesn't appear as an own property on the C instance"
|
||||
);
|
||||
|
||||
verifyProperty(C.prototype, "m", {
|
||||
enumerable: false,
|
||||
|
|
|
@ -40,8 +40,14 @@ var y = Symbol();
|
|||
//- assertions
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, y), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, y),
|
||||
"y does not appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, y),
|
||||
"y does not appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
verifyProperty(c, y, {
|
||||
value: "same_value",
|
||||
|
|
|
@ -40,8 +40,14 @@ y = (x.push("d"), "same_value");
|
|||
//- assertions
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "y"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "y"),
|
||||
"y does not appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "y"),
|
||||
"y does not appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
verifyProperty(c, "y", {
|
||||
value: "same_value",
|
||||
|
|
|
@ -81,10 +81,22 @@ assert.sameValue(c.g, undefined);
|
|||
assert.sameValue(c.h, undefined);
|
||||
assert.sameValue(c[0], undefined);
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, 'f'), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, 'g'), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, 'h'), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, 0), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, 'f'),
|
||||
"f does not appear as an own property on the C instance"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, 'g'),
|
||||
"g does not appear as an own property on the C instance"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, 'h'),
|
||||
"h does not appear as an own property on the C instance"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, 0),
|
||||
"0 does not appear as an own property on the C instance"
|
||||
);
|
||||
|
||||
verifyProperty(C, 'f', {
|
||||
value: 'test262',
|
||||
|
|
|
@ -35,18 +35,18 @@ static y() {
|
|||
//- assertions
|
||||
|
||||
// Test the private fields do not appear as properties before set to value
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1");
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2");
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
|
||||
assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4");
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5");
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
|
||||
assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
|
||||
|
||||
// Test if private fields can be sucessfully accessed and set to value
|
||||
assert.sameValue(C.x(), 42, "test 7");
|
||||
assert.sameValue(C.y(), 43, "test 8");
|
||||
|
||||
// Test the private fields do not appear as properties before after set to value
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9");
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
|
||||
|
|
|
@ -41,29 +41,29 @@ static y() {
|
|||
//- assertions
|
||||
|
||||
// Test the private methods do not appear as properties before set to value
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1");
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2");
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
|
||||
assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4");
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5");
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
|
||||
assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7");
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8");
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8");
|
||||
assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9");
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10");
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11");
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11");
|
||||
assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "test 12");
|
||||
|
||||
// Test if private fields can be sucessfully accessed and set to value
|
||||
assert.sameValue(C.x(), 42, "test 13");
|
||||
assert.sameValue(C.y(), 43, "test 14");
|
||||
|
||||
// Test the private fields do not appear as properties before after set to value
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15");
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16");
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17");
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 18");
|
||||
|
|
|
@ -37,18 +37,18 @@ static y() {
|
|||
//- assertions
|
||||
|
||||
// Test the private methods do not appear as properties before set to value
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1");
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2");
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
|
||||
assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4");
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5");
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
|
||||
assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
|
||||
|
||||
// Test if private fields can be sucessfully accessed and set to value
|
||||
assert.sameValue(C.x(), 42, "test 7");
|
||||
assert.sameValue(C.y(), 86, "test 8");
|
||||
|
||||
// Test the private fields do not appear as properties before after set to value
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9");
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
|
||||
assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
|
||||
|
|
|
@ -22,8 +22,14 @@ features: [class-fields-public]
|
|||
'a'; "b"; 'c' = 39;
|
||||
"d" = 42
|
||||
//- assertions
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "a"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "a"),
|
||||
"a does not appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "a"),
|
||||
"a does not appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
verifyProperty(c, "a", {
|
||||
value: undefined,
|
||||
|
@ -32,8 +38,14 @@ verifyProperty(c, "a", {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "b"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "b"),
|
||||
"b does not appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "b"),
|
||||
"b does not appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
verifyProperty(c, "b", {
|
||||
value: undefined,
|
||||
|
@ -42,8 +54,14 @@ verifyProperty(c, "b", {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "c"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "c"),
|
||||
"c does not appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "c"),
|
||||
"c does not appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
verifyProperty(c, "c", {
|
||||
value: 39,
|
||||
|
@ -52,8 +70,14 @@ verifyProperty(c, "c", {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false);
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "d"), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "d"),
|
||||
"d does not appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "d"),
|
||||
"d does not appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
verifyProperty(c, "d", {
|
||||
value: 42,
|
||||
|
|
|
@ -31,9 +31,18 @@ class C {
|
|||
const c = new C();
|
||||
|
||||
// Test the private fields do not appear as properties before set to value
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")');
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
|
||||
"Private field '#gen' does not appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "#gen"),
|
||||
"Private field '#gen' does not appear as an own property on C constructor"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "#gen"),
|
||||
"Private field '#gen' does not appear as an own property on C instance"
|
||||
);
|
||||
|
||||
var iter = c.gen();
|
||||
|
||||
|
@ -42,6 +51,15 @@ var iter = c.gen();
|
|||
assert.sameValue(callCount, 1);
|
||||
|
||||
// Test the private fields do not appear as properties after set to value
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")');
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
|
||||
"Private field '#gen' does not appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "#gen"),
|
||||
"Private field '#gen' does not appear as an own property on C constructor"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "#gen"),
|
||||
"Private field '#gen' does not appear as an own property on C instance"
|
||||
);
|
||||
|
|
|
@ -29,8 +29,14 @@ class C {
|
|||
}
|
||||
|
||||
// Test the private fields do not appear as properties before set to value
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
|
||||
"Private field '#gen' does not appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "#gen"),
|
||||
"Private field '#gen' does not appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
var iter = C.gen();
|
||||
|
||||
|
@ -39,5 +45,11 @@ var iter = C.gen();
|
|||
assert.sameValue(callCount, 1);
|
||||
|
||||
// Test the private fields do not appear as properties before set to value
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
|
||||
"Private field '#gen' does not appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "#gen"),
|
||||
"Private field '#gen' does not appear as an own property on C constructor"
|
||||
);
|
||||
|
|
|
@ -31,9 +31,18 @@ var C = class {
|
|||
const c = new C();
|
||||
|
||||
// Test the private fields do not appear as properties before set to value
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")');
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
|
||||
"Private field '#gen' does not appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "#gen"),
|
||||
"Private field '#gen' does not appear as an own property on C constructor"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "#gen"),
|
||||
"Private field '#gen' does not appear as an own property on C instance"
|
||||
);
|
||||
|
||||
var iter = c.gen();
|
||||
|
||||
|
@ -42,6 +51,15 @@ var iter = c.gen();
|
|||
assert.sameValue(callCount, 1);
|
||||
|
||||
// Test the private fields do not appear as properties after set to value
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")');
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
|
||||
"Private field '#gen' does not appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "#gen"),
|
||||
"Private field '#gen' does not appear as an own property on C constructor"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(c, "#gen"),
|
||||
"Private field '#gen' does not appear as an own property on C instance"
|
||||
);
|
||||
|
|
|
@ -29,8 +29,14 @@ var C = class {
|
|||
}
|
||||
|
||||
// Test the private fields do not appear as properties before set to value
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
|
||||
"Private field '#gen' does not appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "#gen"),
|
||||
"Private field '#gen' does not appear as an own property on C constructor"
|
||||
);
|
||||
|
||||
var iter = C.gen();
|
||||
|
||||
|
@ -39,5 +45,11 @@ var iter = C.gen();
|
|||
assert.sameValue(callCount, 1);
|
||||
|
||||
// Test the private fields do not appear as properties before set to value
|
||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
|
||||
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
|
||||
"Private field '#gen' does not appear as an own property on C prototype"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(C, "#gen"),
|
||||
"Private field '#gen' does not appear as an own property on C constructor"
|
||||
);
|
||||
|
|
|
@ -45,5 +45,5 @@ assert.sameValue(value.z, 30);
|
|||
assert.sameValue(value.a, 1);
|
||||
assert.sameValue(value.b, 2);
|
||||
assert.sameValue(value[s], 42);
|
||||
assert(Object.hasOwnProperty.call(value, s));
|
||||
assert(Object.prototype.hasOwnProperty.call(value, s), "s is an own property");
|
||||
assert.sameValue(Object.keys(value).length, 5);
|
||||
|
|
|
@ -29,7 +29,7 @@ obj
|
|||
//- body
|
||||
|
||||
assert.sameValue(obj[symbol], 1);
|
||||
assert(Object.hasOwnProperty.call(obj, symbol));
|
||||
assert(Object.prototype.hasOwnProperty.call(obj, symbol), "symbol is an own property");
|
||||
assert.sameValue(obj.c, 4);
|
||||
assert.sameValue(obj.d, 5);
|
||||
assert.sameValue(Object.keys(obj).length, 2);
|
||||
|
|
|
@ -26,4 +26,4 @@ for (const unscopable of ["toReversed", "toSorted", "toSpliced"]) {
|
|||
})
|
||||
};
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(unscopables, "with"), false, "does not have `with`");
|
||||
assert(!Object.prototype.hasOwnProperty.call(unscopables, "with"), "does not have `with`");
|
||||
|
|
|
@ -33,10 +33,10 @@ async function* asyncg() {
|
|||
|
||||
asyncg().next().then(function (result) {
|
||||
assert(
|
||||
Object.hasOwnProperty.call(result, 'value'), 'Has "own" property `value`'
|
||||
Object.prototype.hasOwnProperty.call(result, 'value'), 'Has "own" property `value`'
|
||||
);
|
||||
assert(
|
||||
Object.hasOwnProperty.call(result, 'done'), 'Has "own" property `done`'
|
||||
Object.prototype.hasOwnProperty.call(result, 'done'), 'Has "own" property `done`'
|
||||
);
|
||||
assert.sameValue(Object.getPrototypeOf(result), Object.prototype);
|
||||
}).then($DONE, $DONE);
|
||||
|
|
|
@ -37,10 +37,10 @@ async function* g() {}
|
|||
|
||||
g().next().then(function (result) {
|
||||
assert(
|
||||
Object.hasOwnProperty.call(result, 'value'), 'Has "own" property `value`'
|
||||
Object.prototype.hasOwnProperty.call(result, 'value'), 'Has "own" property `value`'
|
||||
);
|
||||
assert(
|
||||
Object.hasOwnProperty.call(result, 'done'), 'Has "own" property `done`'
|
||||
Object.prototype.hasOwnProperty.call(result, 'done'), 'Has "own" property `done`'
|
||||
);
|
||||
assert.sameValue(Object.getPrototypeOf(result), Object.prototype);
|
||||
}).then($DONE, $DONE)
|
||||
|
|
|
@ -38,10 +38,10 @@ async function* g() {}
|
|||
|
||||
g().return().then(function (result) {
|
||||
assert(
|
||||
Object.hasOwnProperty.call(result, 'value'), 'Has "own" property `value`'
|
||||
Object.prototype.hasOwnProperty.call(result, 'value'), 'Has "own" property `value`'
|
||||
);
|
||||
assert(
|
||||
Object.hasOwnProperty.call(result, 'done'), 'Has "own" property `done`'
|
||||
Object.prototype.hasOwnProperty.call(result, 'done'), 'Has "own" property `done`'
|
||||
);
|
||||
assert.sameValue(Object.getPrototypeOf(result), Object.prototype);
|
||||
}).then($DONE, $DONE)
|
||||
|
|
|
@ -12,9 +12,9 @@ function* g() {}
|
|||
var result = g().next();
|
||||
|
||||
assert(
|
||||
Object.hasOwnProperty.call(result, 'value'), 'Has "own" property `value`'
|
||||
Object.prototype.hasOwnProperty.call(result, 'value'), 'Has "own" property `value`'
|
||||
);
|
||||
assert(
|
||||
Object.hasOwnProperty.call(result, 'done'), 'Has "own" property `done`'
|
||||
Object.prototype.hasOwnProperty.call(result, 'done'), 'Has "own" property `done`'
|
||||
);
|
||||
assert.sameValue(Object.getPrototypeOf(result), Object.prototype);
|
||||
|
|
|
@ -7,8 +7,8 @@ es5id: 15.2.3_A3
|
|||
description: Checking Object.length
|
||||
---*/
|
||||
assert(
|
||||
!!Object.hasOwnProperty("length"),
|
||||
'The value of !!Object.hasOwnProperty("length") is expected to be true'
|
||||
Object.prototype.hasOwnProperty.call(Object, "length"),
|
||||
"The Object constructor has a 'length' own property"
|
||||
);
|
||||
|
||||
assert.sameValue(Object.length, 1, 'The value of Object.length is expected to be 1');
|
||||
|
|
|
@ -21,5 +21,8 @@ var result;
|
|||
|
||||
result = Object.assign(target, source);
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(target, 'attr'), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(target, 'attr'),
|
||||
"Non-enumerable property 'attr' does not get copied to target"
|
||||
);
|
||||
assert.sameValue(result, target);
|
||||
|
|
|
@ -27,9 +27,8 @@ var source = new Proxy({}, {
|
|||
result = Object.assign(target, source);
|
||||
|
||||
assert.sameValue(callCount, 1, 'Proxy trap was invoked exactly once');
|
||||
assert.sameValue(
|
||||
Object.hasOwnProperty.call(target, 'missing'),
|
||||
false,
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(target, 'missing'),
|
||||
'An own property was not created for a property without a property descriptor'
|
||||
);
|
||||
assert.sameValue(result, target);
|
||||
|
|
|
@ -6,6 +6,7 @@ es5id: 15.2.3.6-4-116
|
|||
description: >
|
||||
Object.defineProperty - 'O' is an Array, test the length property
|
||||
of 'O' is own data property (15.4.5.1 step 1)
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var arrObj = [0, 1];
|
||||
|
@ -20,10 +21,9 @@ assert.throws(TypeError, function() {
|
|||
});
|
||||
});
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(arrObj, "length");
|
||||
|
||||
assert(Object.hasOwnProperty.call(arrObj, "length"), 'Object.hasOwnProperty.call(arrObj, "length")');
|
||||
assert.sameValue(desc.value, 2, 'desc.value');
|
||||
assert.sameValue(desc.writable, true, 'desc.writable');
|
||||
assert.sameValue(desc.configurable, false, 'desc.configurable');
|
||||
assert.sameValue(desc.enumerable, false, 'desc.enumerable');
|
||||
verifyProperty(arrObj, "length", {
|
||||
value: 2,
|
||||
writable: true,
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
});
|
||||
|
|
|
@ -6,31 +6,11 @@ es5id: 15.2.3.6-4-598
|
|||
description: >
|
||||
ES5 Attributes - all attributes in Object.getPrototypeOf are
|
||||
correct
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(Object, "getPrototypeOf");
|
||||
|
||||
var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true);
|
||||
|
||||
var temp = Object.getPrototypeOf;
|
||||
|
||||
Object.getPrototypeOf = "2010";
|
||||
|
||||
var isWritable = (Object.getPrototypeOf === "2010");
|
||||
|
||||
var isEnumerable = false;
|
||||
|
||||
for (var prop in Object) {
|
||||
if (prop === "getPrototypeOf") {
|
||||
isEnumerable = true;
|
||||
}
|
||||
}
|
||||
|
||||
delete Object.getPrototypeOf;
|
||||
|
||||
var isConfigurable = !Object.hasOwnProperty("getPrototypeOf");
|
||||
|
||||
assert(propertyAreCorrect, 'propertyAreCorrect !== true');
|
||||
assert(isWritable, 'isWritable !== true');
|
||||
assert.sameValue(isEnumerable, false, 'isEnumerable');
|
||||
assert(isConfigurable, 'isConfigurable !== true');
|
||||
verifyProperty(Object, "getPrototypeOf", {
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
|
|
@ -6,31 +6,11 @@ es5id: 15.2.3.6-4-599
|
|||
description: >
|
||||
ES5 Attributes - all attributes in Object.getOwnPropertyDescriptor
|
||||
are correct
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(Object, "getOwnPropertyDescriptor");
|
||||
|
||||
var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true);
|
||||
|
||||
var temp = Object.getOwnPropertyDescriptor;
|
||||
|
||||
Object.getOwnPropertyDescriptor = "2010";
|
||||
|
||||
var isWritable = (Object.getOwnPropertyDescriptor === "2010");
|
||||
|
||||
var isEnumerable = false;
|
||||
|
||||
for (var prop in Object) {
|
||||
if (prop === "getOwnPropertyDescriptor") {
|
||||
isEnumerable = true;
|
||||
}
|
||||
}
|
||||
|
||||
delete Object.getOwnPropertyDescriptor;
|
||||
|
||||
var isConfigurable = !Object.hasOwnProperty("getOwnPropertyDescriptor");
|
||||
|
||||
assert(propertyAreCorrect, 'propertyAreCorrect !== true');
|
||||
assert(isWritable, 'isWritable !== true');
|
||||
assert.sameValue(isEnumerable, false, 'isEnumerable');
|
||||
assert(isConfigurable, 'isConfigurable !== true');
|
||||
verifyProperty(Object, "getOwnPropertyDescriptor", {
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
|
|
@ -6,31 +6,11 @@ es5id: 15.2.3.6-4-600
|
|||
description: >
|
||||
ES5 Attributes - all attributes in Object.getOwnPropertyNames are
|
||||
correct
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(Object, "getOwnPropertyNames");
|
||||
|
||||
var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true);
|
||||
|
||||
var temp = Object.getOwnPropertyNames;
|
||||
|
||||
Object.getOwnPropertyNames = "2010";
|
||||
|
||||
var isWritable = (Object.getOwnPropertyNames === "2010");
|
||||
|
||||
var isEnumerable = false;
|
||||
|
||||
for (var prop in Object) {
|
||||
if (prop === "getOwnPropertyNames") {
|
||||
isEnumerable = true;
|
||||
}
|
||||
}
|
||||
|
||||
delete Object.getOwnPropertyNames;
|
||||
|
||||
var isConfigurable = !Object.hasOwnProperty("getOwnPropertyNames");
|
||||
|
||||
assert(propertyAreCorrect, 'propertyAreCorrect !== true');
|
||||
assert(isWritable, 'isWritable !== true');
|
||||
assert.sameValue(isEnumerable, false, 'isEnumerable');
|
||||
assert(isConfigurable, 'isConfigurable !== true');
|
||||
verifyProperty(Object, "getOwnPropertyNames", {
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
|
|
@ -4,31 +4,11 @@
|
|||
/*---
|
||||
es5id: 15.2.3.6-4-601
|
||||
description: ES5 Attributes - all attributes in Object.create are correct
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(Object, "create");
|
||||
|
||||
var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true);
|
||||
|
||||
var temp = Object.create;
|
||||
|
||||
Object.create = "2010";
|
||||
|
||||
var isWritable = (Object.create === "2010");
|
||||
|
||||
var isEnumerable = false;
|
||||
|
||||
for (var prop in Object) {
|
||||
if (prop === "create") {
|
||||
isEnumerable = true;
|
||||
}
|
||||
}
|
||||
|
||||
delete Object.create;
|
||||
|
||||
var isConfigurable = !Object.hasOwnProperty("create");
|
||||
|
||||
assert(propertyAreCorrect, 'propertyAreCorrect !== true');
|
||||
assert(isWritable, 'isWritable !== true');
|
||||
assert.sameValue(isEnumerable, false, 'isEnumerable');
|
||||
assert(isConfigurable, 'isConfigurable !== true');
|
||||
verifyProperty(Object, "getPrototypeOf", {
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
|
|
@ -6,30 +6,11 @@ es5id: 15.2.3.6-4-602
|
|||
description: >
|
||||
ES5 Attributes - all attributes in Object.defineProperty are
|
||||
correct
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(Object, "defineProperty");
|
||||
|
||||
var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true);
|
||||
var temp = Object.defineProperty;
|
||||
|
||||
Object.defineProperty = "2010";
|
||||
|
||||
var isWritable = (Object.defineProperty === "2010");
|
||||
|
||||
var isEnumerable = false;
|
||||
|
||||
for (var prop in Object) {
|
||||
if (prop === "defineProperty") {
|
||||
isEnumerable = true;
|
||||
}
|
||||
}
|
||||
|
||||
delete Object.defineProperty;
|
||||
|
||||
var isConfigurable = !Object.hasOwnProperty("defineProperty");
|
||||
|
||||
assert(propertyAreCorrect, 'propertyAreCorrect !== true');
|
||||
assert(isWritable, 'isWritable !== true');
|
||||
assert.sameValue(isEnumerable, false, 'isEnumerable');
|
||||
assert(isConfigurable, 'isConfigurable !== true');
|
||||
verifyProperty(Object, "defineProperty", {
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
|
|
@ -6,31 +6,11 @@ es5id: 15.2.3.6-4-603
|
|||
description: >
|
||||
ES5 Attributes - all attributes in Object.defineProperties are
|
||||
correct
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(Object, "defineProperties");
|
||||
|
||||
var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true);
|
||||
|
||||
var temp = Object.defineProperties;
|
||||
|
||||
Object.defineProperties = "2010";
|
||||
|
||||
var isWritable = (Object.defineProperties === "2010");
|
||||
|
||||
var isEnumerable = false;
|
||||
|
||||
for (var prop in Object) {
|
||||
if (prop === "defineProperties") {
|
||||
isEnumerable = true;
|
||||
}
|
||||
}
|
||||
|
||||
delete Object.defineProperties;
|
||||
|
||||
var isConfigurable = !Object.hasOwnProperty("defineProperties");
|
||||
|
||||
assert(propertyAreCorrect, 'propertyAreCorrect !== true');
|
||||
assert(isWritable, 'isWritable !== true');
|
||||
assert.sameValue(isEnumerable, false, 'isEnumerable');
|
||||
assert(isConfigurable, 'isConfigurable !== true');
|
||||
verifyProperty(Object, "defineProperties", {
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
|
|
@ -4,31 +4,11 @@
|
|||
/*---
|
||||
es5id: 15.2.3.6-4-604
|
||||
description: ES5 Attributes - all attributes in Object.seal are correct
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(Object, "seal");
|
||||
|
||||
var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true);
|
||||
|
||||
var temp = Object.seal;
|
||||
|
||||
Object.seal = "2010";
|
||||
|
||||
var isWritable = (Object.seal === "2010");
|
||||
|
||||
var isEnumerable = false;
|
||||
|
||||
for (var prop in Object) {
|
||||
if (prop === "seal") {
|
||||
isEnumerable = true;
|
||||
}
|
||||
}
|
||||
|
||||
delete Object.seal;
|
||||
|
||||
var isConfigurable = !Object.hasOwnProperty("seal");
|
||||
|
||||
assert(propertyAreCorrect, 'propertyAreCorrect !== true');
|
||||
assert(isWritable, 'isWritable !== true');
|
||||
assert.sameValue(isEnumerable, false, 'isEnumerable');
|
||||
assert(isConfigurable, 'isConfigurable !== true');
|
||||
verifyProperty(Object, "seal", {
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
|
|
@ -4,31 +4,11 @@
|
|||
/*---
|
||||
es5id: 15.2.3.6-4-605
|
||||
description: ES5 Attributes - all attributes in Object.freeze are correct
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(Object, "freeze");
|
||||
|
||||
var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true);
|
||||
|
||||
var temp = Object.freeze;
|
||||
|
||||
Object.freeze = "2010";
|
||||
|
||||
var isWritable = (Object.freeze === "2010");
|
||||
|
||||
var isEnumerable = false;
|
||||
|
||||
for (var prop in Object) {
|
||||
if (prop === "freeze") {
|
||||
isEnumerable = true;
|
||||
}
|
||||
}
|
||||
|
||||
delete Object.freeze;
|
||||
|
||||
var isConfigurable = !Object.hasOwnProperty("freeze");
|
||||
|
||||
assert(propertyAreCorrect, 'propertyAreCorrect !== true');
|
||||
assert(isWritable, 'isWritable !== true');
|
||||
assert.sameValue(isEnumerable, false, 'isEnumerable');
|
||||
assert(isConfigurable, 'isConfigurable !== true');
|
||||
verifyProperty(Object, "freeze", {
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
|
|
@ -6,31 +6,11 @@ es5id: 15.2.3.6-4-606
|
|||
description: >
|
||||
ES5 Attributes - all attributes in Object.preventExtensions are
|
||||
correct
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(Object, "preventExtensions");
|
||||
|
||||
var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true);
|
||||
|
||||
var temp = Object.preventExtensions;
|
||||
|
||||
Object.preventExtensions = "2010";
|
||||
|
||||
var isWritable = (Object.preventExtensions === "2010");
|
||||
|
||||
var isEnumerable = false;
|
||||
|
||||
for (var prop in Object) {
|
||||
if (prop === "preventExtensions") {
|
||||
isEnumerable = true;
|
||||
}
|
||||
}
|
||||
|
||||
delete Object.preventExtensions;
|
||||
|
||||
var isConfigurable = !Object.hasOwnProperty("preventExtensions");
|
||||
|
||||
assert(propertyAreCorrect, 'propertyAreCorrect !== true');
|
||||
assert(isWritable, 'isWritable !== true');
|
||||
assert.sameValue(isEnumerable, false, 'isEnumerable');
|
||||
assert(isConfigurable, 'isConfigurable !== true');
|
||||
verifyProperty(Object, "preventExtensions", {
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
|
|
@ -4,31 +4,11 @@
|
|||
/*---
|
||||
es5id: 15.2.3.6-4-607
|
||||
description: ES5 Attributes - all attributes in Object.isSealed are correct
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(Object, "isSealed");
|
||||
|
||||
var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true);
|
||||
|
||||
var temp = Object.isSealed;
|
||||
|
||||
Object.isSealed = "2010";
|
||||
|
||||
var isWritable = (Object.isSealed === "2010");
|
||||
|
||||
var isEnumerable = false;
|
||||
|
||||
for (var prop in Object) {
|
||||
if (prop === "isSealed") {
|
||||
isEnumerable = true;
|
||||
}
|
||||
}
|
||||
|
||||
delete Object.isSealed;
|
||||
|
||||
var isConfigurable = !Object.hasOwnProperty("isSealed");
|
||||
|
||||
assert(propertyAreCorrect, 'propertyAreCorrect !== true');
|
||||
assert(isWritable, 'isWritable !== true');
|
||||
assert.sameValue(isEnumerable, false, 'isEnumerable');
|
||||
assert(isConfigurable, 'isConfigurable !== true');
|
||||
verifyProperty(Object, "isSealed", {
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
|
|
@ -4,31 +4,11 @@
|
|||
/*---
|
||||
es5id: 15.2.3.6-4-608
|
||||
description: ES5 Attributes - all attributes in Object.isFrozen are correct
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(Object, "isFrozen");
|
||||
|
||||
var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true);
|
||||
|
||||
var temp = Object.isFrozen;
|
||||
|
||||
Object.isFrozen = "2010";
|
||||
|
||||
var isWritable = (Object.isFrozen === "2010");
|
||||
|
||||
var isEnumerable = false;
|
||||
|
||||
for (var prop in Object) {
|
||||
if (prop === "isFrozen") {
|
||||
isEnumerable = true;
|
||||
}
|
||||
}
|
||||
|
||||
delete Object.isFrozen;
|
||||
|
||||
var isConfigurable = !Object.hasOwnProperty("isFrozen");
|
||||
|
||||
assert(propertyAreCorrect, 'propertyAreCorrect !== true');
|
||||
assert(isWritable, 'isWritable !== true');
|
||||
assert.sameValue(isEnumerable, false, 'isEnumerable');
|
||||
assert(isConfigurable, 'isConfigurable !== true');
|
||||
verifyProperty(Object, "isFrozen", {
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
|
|
@ -4,31 +4,11 @@
|
|||
/*---
|
||||
es5id: 15.2.3.6-4-609
|
||||
description: ES5 Attributes - all attributes in Object.isExtensible are correct
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(Object, "isExtensible");
|
||||
|
||||
var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true);
|
||||
|
||||
var temp = Object.isExtensible;
|
||||
|
||||
Object.isExtensible = "2010";
|
||||
|
||||
var isWritable = (Object.isExtensible === "2010");
|
||||
|
||||
var isEnumerable = false;
|
||||
|
||||
for (var prop in Object) {
|
||||
if (prop === "isExtensible") {
|
||||
isEnumerable = true;
|
||||
}
|
||||
}
|
||||
|
||||
delete Object.isExtensible;
|
||||
|
||||
var isConfigurable = !Object.hasOwnProperty("isExtensible");
|
||||
|
||||
assert(propertyAreCorrect, 'propertyAreCorrect !== true');
|
||||
assert(isWritable, 'isWritable !== true');
|
||||
assert.sameValue(isEnumerable, false, 'isEnumerable');
|
||||
assert(isConfigurable, 'isConfigurable !== true');
|
||||
verifyProperty(Object, "isExtensible", {
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
|
|
@ -4,31 +4,11 @@
|
|||
/*---
|
||||
es5id: 15.2.3.6-4-610
|
||||
description: ES5 Attributes - all attributes in Object.keys are correct
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(Object, "keys");
|
||||
|
||||
var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true);
|
||||
|
||||
var temp = Object.keys;
|
||||
|
||||
Object.keys = "2010";
|
||||
|
||||
var isWritable = (Object.keys === "2010");
|
||||
|
||||
var isEnumerable = false;
|
||||
|
||||
for (var prop in Object) {
|
||||
if (prop === "keys") {
|
||||
isEnumerable = true;
|
||||
}
|
||||
}
|
||||
|
||||
delete Object.keys;
|
||||
|
||||
var isConfigurable = !Object.hasOwnProperty("keys");
|
||||
|
||||
assert(propertyAreCorrect, 'propertyAreCorrect !== true');
|
||||
assert(isWritable, 'isWritable !== true');
|
||||
assert.sameValue(isEnumerable, false, 'isEnumerable');
|
||||
assert(isConfigurable, 'isConfigurable !== true');
|
||||
verifyProperty(Object, "keys", {
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
|
|
@ -5,6 +5,7 @@ es6id: 19.1.2.4
|
|||
description: >
|
||||
Symbol used as property for configurable data property definition
|
||||
features: [Symbol]
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
var sym = Symbol();
|
||||
var obj = {};
|
||||
|
@ -16,18 +17,13 @@ Object.defineProperty(obj, sym, {
|
|||
});
|
||||
|
||||
assert.sameValue(sym in obj, true, "The result of `sym in obj` is `true`");
|
||||
assert.sameValue(
|
||||
Object.hasOwnProperty.call(obj, sym),
|
||||
true,
|
||||
"`Object.hasOwnProperty.call(obj, sym)` returns `true`"
|
||||
);
|
||||
verifyProperty(obj, sym, {
|
||||
value: 1,
|
||||
configurable: true,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
});
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(obj, sym);
|
||||
|
||||
assert.sameValue(desc.value, 1, "The value of `desc.value` is `1`");
|
||||
assert.sameValue(desc.configurable, true, "The value of `desc.configurable` is `true`");
|
||||
assert.sameValue(desc.writable, false, "The value of `desc.writable` is `false`");
|
||||
assert.sameValue(desc.enumerable, false, "The value of `desc.enumerable` is `false`");
|
||||
assert.sameValue(
|
||||
Object.prototype.propertyIsEnumerable.call(obj, sym),
|
||||
false,
|
||||
|
|
|
@ -6,6 +6,7 @@ description: >
|
|||
Symbol used as property for property definition
|
||||
flags: [noStrict]
|
||||
features: [Symbol]
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
var sym = Symbol();
|
||||
var obj = {};
|
||||
|
@ -16,18 +17,13 @@ Object.defineProperty(obj, sym, {
|
|||
});
|
||||
|
||||
assert.sameValue(sym in obj, true, "The result of `sym in obj` is `true`");
|
||||
assert.sameValue(
|
||||
Object.hasOwnProperty.call(obj, sym),
|
||||
true,
|
||||
"`Object.hasOwnProperty.call(obj, sym)` returns `true`"
|
||||
);
|
||||
verifyProperty(obj, sym, {
|
||||
value: 1,
|
||||
configurable: false,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
});
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(obj, sym);
|
||||
|
||||
assert.sameValue(desc.value, 1, "The value of `desc.value` is `1`");
|
||||
assert.sameValue(desc.configurable, false, "The value of `desc.configurable` is `false`");
|
||||
assert.sameValue(desc.writable, false, "The value of `desc.writable` is `false`");
|
||||
assert.sameValue(desc.enumerable, false, "The value of `desc.enumerable` is `false`");
|
||||
assert.sameValue(
|
||||
Object.prototype.propertyIsEnumerable.call(obj, sym),
|
||||
false,
|
||||
|
|
|
@ -6,6 +6,7 @@ description: >
|
|||
Symbol used as property for default data property definition
|
||||
flags: [onlyStrict]
|
||||
features: [Symbol]
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
var sym = Symbol();
|
||||
var obj = {};
|
||||
|
@ -16,18 +17,13 @@ Object.defineProperty(obj, sym, {
|
|||
});
|
||||
|
||||
assert.sameValue(sym in obj, true, "The result of `sym in obj` is `true`");
|
||||
assert.sameValue(
|
||||
Object.hasOwnProperty.call(obj, sym),
|
||||
true,
|
||||
"`Object.hasOwnProperty.call(obj, sym)` returns `true`"
|
||||
);
|
||||
verifyProperty(obj, sym, {
|
||||
value: 1,
|
||||
configurable: false,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
});
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(obj, sym);
|
||||
|
||||
assert.sameValue(desc.value, 1, "The value of `desc.value` is `1`");
|
||||
assert.sameValue(desc.configurable, false, "The value of `desc.configurable` is `false`");
|
||||
assert.sameValue(desc.writable, false, "The value of `desc.writable` is `false`");
|
||||
assert.sameValue(desc.enumerable, false, "The value of `desc.enumerable` is `false`");
|
||||
assert.sameValue(
|
||||
Object.prototype.propertyIsEnumerable.call(obj, sym),
|
||||
false,
|
||||
|
|
|
@ -5,6 +5,7 @@ es6id: 19.1.2.4
|
|||
description: >
|
||||
Symbol used as property for writable data property definition
|
||||
features: [Symbol]
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
var sym = Symbol();
|
||||
var obj = {};
|
||||
|
@ -16,18 +17,13 @@ Object.defineProperty(obj, sym, {
|
|||
});
|
||||
|
||||
assert.sameValue(sym in obj, true, "The result of `sym in obj` is `true`");
|
||||
assert.sameValue(
|
||||
Object.hasOwnProperty.call(obj, sym),
|
||||
true,
|
||||
"`Object.hasOwnProperty.call(obj, sym)` returns `true`"
|
||||
);
|
||||
verifyProperty(obj, sym, {
|
||||
value: 1,
|
||||
configurable: false,
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
});
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(obj, sym);
|
||||
|
||||
assert.sameValue(desc.value, 1, "The value of `desc.value` is `1`");
|
||||
assert.sameValue(desc.configurable, false, "The value of `desc.configurable` is `false`");
|
||||
assert.sameValue(desc.writable, true, "The value of `desc.writable` is `true`");
|
||||
assert.sameValue(desc.enumerable, false, "The value of `desc.enumerable` is `false`");
|
||||
assert.sameValue(
|
||||
Object.prototype.propertyIsEnumerable.call(obj, sym),
|
||||
false,
|
||||
|
|
|
@ -24,5 +24,8 @@ var result;
|
|||
result = Object.setPrototypeOf(obj, newProto);
|
||||
|
||||
assert.sameValue(result, obj, 'Return value');
|
||||
assert.sameValue(Object.hasOwnProperty.call(obj, 'test262prop'), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(obj, 'test262prop'),
|
||||
"'test262prop' isn't copied to an own property"
|
||||
);
|
||||
assert.sameValue(obj.test262prop, propValue);
|
||||
|
|
|
@ -29,18 +29,26 @@ var plainObjectTarget = new Proxy(plainObject, {});
|
|||
var plainObjectProxy = new Proxy(plainObjectTarget, {});
|
||||
|
||||
assert(delete plainObjectProxy.foo);
|
||||
assert(!plainObject.hasOwnProperty("foo"));
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(plainObject, "foo"),
|
||||
"'foo' property was deleted from original object"
|
||||
);
|
||||
|
||||
assert(!Reflect.deleteProperty(plainObjectProxy, "bar"));
|
||||
assert(plainObject.hasOwnProperty("bar"));
|
||||
|
||||
assert(
|
||||
Object.prototype.hasOwnProperty.call(plainObject, "bar"),
|
||||
"'bar' property was not deleted from original object"
|
||||
);
|
||||
|
||||
var func = function() {};
|
||||
var funcTarget = new Proxy(func, {});
|
||||
var funcProxy = new Proxy(funcTarget, {});
|
||||
|
||||
assert(delete funcProxy.length);
|
||||
assert(!func.hasOwnProperty("length"));
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(func, "length"),
|
||||
"'length' property was deleted from original object"
|
||||
);
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
"use strict";
|
||||
|
|
|
@ -9,4 +9,7 @@ description: >
|
|||
features: [Proxy]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(Proxy, 'prototype'), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(Proxy, 'prototype'),
|
||||
"Proxy constructor does not have a prototype property"
|
||||
);
|
||||
|
|
|
@ -25,17 +25,15 @@ var result = /.(.)./g[Symbol.match]('abcdefghi');
|
|||
|
||||
assert(Array.isArray(result));
|
||||
|
||||
assert.sameValue(
|
||||
Object.hasOwnProperty.call(result, 'index'),
|
||||
false,
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(result, 'index'),
|
||||
'Does not define an `index` "own" property'
|
||||
);
|
||||
assert.sameValue(
|
||||
result.index, undefined, 'Does not define an `index` property'
|
||||
);
|
||||
assert.sameValue(
|
||||
Object.hasOwnProperty.call(result, 'input'),
|
||||
false,
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(result, 'input'),
|
||||
'Does not define an `input` "own" property'
|
||||
);
|
||||
assert.sameValue(
|
||||
|
|
|
@ -43,6 +43,7 @@ for (const args of optionsArguments) {
|
|||
const resolvedOptions = segmenter.resolvedOptions();
|
||||
assert.sameValue(resolvedOptions.granularity, "grapheme",
|
||||
`Calling with ${args.length} empty arguments should yield the correct value for "granularity"`);
|
||||
assert.sameValue(Object.hasOwnProperty(resolvedOptions, "lineBreakStyle"), false,
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(resolvedOptions, "lineBreakStyle"),
|
||||
`Calling with ${args.length} empty arguments should yield the correct value for "lineBreakStyle"`);
|
||||
}
|
||||
|
|
|
@ -24,5 +24,5 @@ var c = new C();
|
|||
|
||||
assert.sameValue(c.a, true, 'a = x in z');
|
||||
assert.sameValue(c.b, false, 'b = y in z');
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "in"), false, "'in'");
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "z"), false, "'z'");
|
||||
assert(!Object.prototype.hasOwnProperty.call(c, "in"), "'in' is not parsed as a field declaration");
|
||||
assert(!Object.prototype.hasOwnProperty.call(c, "z"), "'z' is not parsed as a field declaration");
|
||||
|
|
|
@ -43,7 +43,7 @@ assert.sameValue(
|
|||
);
|
||||
|
||||
assert(
|
||||
Object.hasOwnProperty.call(obj, '__proto__'),
|
||||
Object.prototype.hasOwnProperty.call(obj, '__proto__'),
|
||||
'has own property __proto__'
|
||||
);
|
||||
|
||||
|
|
|
@ -25,9 +25,11 @@ assert.sameValue(obj, null);
|
|||
|
||||
iter.next('propNameViaExpression');
|
||||
|
||||
assert.sameValue(
|
||||
Object.hasOwnProperty.call(obj, 'propNameViaIdentifier'), false
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(obj, 'propNameViaIdentifier'),
|
||||
"The property name is not taken from the 'yield' variable"
|
||||
);
|
||||
assert.sameValue(
|
||||
Object.hasOwnProperty.call(obj, 'propNameViaExpression'), true
|
||||
assert(
|
||||
Object.prototype.hasOwnProperty.call(obj, 'propNameViaExpression'),
|
||||
"The property name is taken from the yield expression"
|
||||
);
|
||||
|
|
|
@ -16,4 +16,7 @@ var obj = {
|
|||
*[yield]() {}
|
||||
};
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(obj, 'propName'), true);
|
||||
assert(
|
||||
Object.prototype.hasOwnProperty.call(obj, 'propName'),
|
||||
"The property name is taken from the 'yield' variable"
|
||||
);
|
||||
|
|
|
@ -25,9 +25,11 @@ assert.sameValue(obj, null);
|
|||
|
||||
iter.next('propNameViaExpression');
|
||||
|
||||
assert.sameValue(
|
||||
Object.hasOwnProperty.call(obj, 'propNameViaIdentifier'), false
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(obj, 'propNameViaIdentifier'),
|
||||
"The property name is not taken from the 'yield' variable"
|
||||
);
|
||||
assert.sameValue(
|
||||
Object.hasOwnProperty.call(obj, 'propNameViaExpression'), true
|
||||
assert(
|
||||
Object.prototype.hasOwnProperty.call(obj, 'propNameViaExpression'),
|
||||
"The property name is taken from the yield expression"
|
||||
);
|
||||
|
|
|
@ -15,4 +15,7 @@ var obj = {
|
|||
[yield]() {}
|
||||
};
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(obj, 'propName'), true);
|
||||
assert(
|
||||
Object.prototype.hasOwnProperty.call(obj, 'propName'),
|
||||
"The property name is taken from the 'yield' variable"
|
||||
);
|
||||
|
|
|
@ -9,4 +9,7 @@ es6id: 14.3.9
|
|||
|
||||
var method = { method() {} }.method;
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(method, 'prototype'), false);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(method, 'prototype'),
|
||||
"Functions declared as methods do not define a 'prototype' property"
|
||||
);
|
||||
|
|
|
@ -48,5 +48,11 @@ var obj = {
|
|||
|
||||
obj.method();
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(obj, 'x'), true);
|
||||
assert.sameValue(Object.hasOwnProperty.call(obj, 'y'), false);
|
||||
assert(
|
||||
Object.prototype.hasOwnProperty.call(obj, 'x'),
|
||||
"x is defined as an own property"
|
||||
);
|
||||
assert(
|
||||
!Object.prototype.hasOwnProperty.call(obj, 'y'),
|
||||
"y is not defined as an own property after the object is frozen"
|
||||
);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue