mirror of https://github.com/tc39/test262.git
Use propertyHelper, add more tests, fix getter calls
This commit is contained in:
parent
cc53f64325
commit
28a66ceb75
|
@ -8,12 +8,18 @@ description: >
|
||||||
info: |
|
info: |
|
||||||
`Symbol.prototype.description` is an accessor property whose
|
`Symbol.prototype.description` is an accessor property whose
|
||||||
set accessor function is undefined.
|
set accessor function is undefined.
|
||||||
|
includes: [propertyHelper.js]
|
||||||
features: [Symbol.prototype.description]
|
features: [Symbol.prototype.description]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
const desc = Object.getOwnPropertyDescriptor(Symbol.prototype, 'description');
|
|
||||||
assert.sameValue(typeof desc.get, 'function');
|
var desc = Object.getOwnPropertyDescriptor(Symbol.prototype, 'description');
|
||||||
|
|
||||||
assert.sameValue(desc.set, undefined);
|
assert.sameValue(desc.set, undefined);
|
||||||
assert.sameValue(desc.writable, undefined);
|
assert.sameValue(desc.writable, undefined);
|
||||||
assert.sameValue(desc.enumerable, false);
|
assert.sameValue(typeof desc.get, 'function');
|
||||||
assert.sameValue(desc.configurable, true);
|
|
||||||
|
verifyProperty(Symbol.prototype, 'description', {
|
||||||
|
enumerable: false,
|
||||||
|
configurable: true,
|
||||||
|
});
|
||||||
|
|
|
@ -19,3 +19,11 @@ assert.sameValue(symbol.hasOwnProperty('description'), false);
|
||||||
const empty = Symbol();
|
const empty = Symbol();
|
||||||
assert.sameValue(empty.description, undefined);
|
assert.sameValue(empty.description, undefined);
|
||||||
assert.sameValue(empty.hasOwnProperty('description'), false);
|
assert.sameValue(empty.hasOwnProperty('description'), false);
|
||||||
|
|
||||||
|
const undef = Symbol(undefined);
|
||||||
|
assert.sameValue(undef.description, undefined);
|
||||||
|
assert.sameValue(undef.hasOwnProperty('description'), false);
|
||||||
|
|
||||||
|
const emptyStr = Symbol('');
|
||||||
|
assert.sameValue(emptyStr.description, '');
|
||||||
|
assert.sameValue(emptyStr.hasOwnProperty('description'), false);
|
||||||
|
|
|
@ -13,30 +13,34 @@ info: |
|
||||||
features: [Symbol.prototype.description]
|
features: [Symbol.prototype.description]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
const getter = Object.getOwnPropertyDescriptor(
|
||||||
|
Symbol.prototype, 'description'
|
||||||
|
).get;
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
Symbol.prototype.description.call(null);
|
getter.call(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
Symbol.prototype.description.call(123);
|
getter.call(123);
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
Symbol.prototype.description.call('test');
|
getter.call('test');
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
Symbol.prototype.description.call(true);
|
getter.call(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
Symbol.prototype.description.call(undefined);
|
getter.call(undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
Symbol.prototype.description.call(new Proxy({}, {}));
|
getter.call(new Proxy({}, {}));
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
Symbol.prototype.description.call({});
|
getter.call({});
|
||||||
});
|
});
|
||||||
|
|
|
@ -19,3 +19,11 @@ assert.sameValue(symbol.hasOwnProperty('description'), false);
|
||||||
const empty = Object(Symbol());
|
const empty = Object(Symbol());
|
||||||
assert.sameValue(empty.description, undefined);
|
assert.sameValue(empty.description, undefined);
|
||||||
assert.sameValue(empty.hasOwnProperty('description'), false);
|
assert.sameValue(empty.hasOwnProperty('description'), false);
|
||||||
|
|
||||||
|
const undef = Object(Symbol(undefined));
|
||||||
|
assert.sameValue(undef.description, undefined);
|
||||||
|
assert.sameValue(undef.hasOwnProperty('description'), false);
|
||||||
|
|
||||||
|
const emptyStr = Object(Symbol(''));
|
||||||
|
assert.sameValue(emptyStr.description, '');
|
||||||
|
assert.sameValue(emptyStr.hasOwnProperty('description'), false);
|
||||||
|
|
Loading…
Reference in New Issue