Use verifyProperty in language/statements tests

This commit is contained in:
André Bargull 2023-09-11 14:13:50 +02:00 committed by Ms2ger
parent 99096762ca
commit ff81dccfc3
48 changed files with 497 additions and 349 deletions

View File

@ -27,37 +27,49 @@ class A {
}
getter = Object.getOwnPropertyDescriptor(A.prototype, 'id').get;
assert.sameValue(getter.name, 'get id');
verifyNotEnumerable(getter, 'name');
verifyNotWritable(getter, 'name');
verifyConfigurable(getter, 'name');
verifyProperty(getter, 'name', {
value: 'get id',
writable: false,
enumerable: false,
configurable: true,
});
getter = Object.getOwnPropertyDescriptor(A.prototype, anonSym).get;
assert.sameValue(getter.name, 'get ');
verifyNotEnumerable(getter, 'name');
verifyNotWritable(getter, 'name');
verifyConfigurable(getter, 'name');
verifyProperty(getter, 'name', {
value: 'get ',
writable: false,
enumerable: false,
configurable: true,
});
getter = Object.getOwnPropertyDescriptor(A.prototype, namedSym).get;
assert.sameValue(getter.name, 'get [test262]');
verifyNotEnumerable(getter, 'name');
verifyNotWritable(getter, 'name');
verifyConfigurable(getter, 'name');
verifyProperty(getter, 'name', {
value: 'get [test262]',
writable: false,
enumerable: false,
configurable: true,
});
getter = Object.getOwnPropertyDescriptor(A, 'id').get;
assert.sameValue(getter.name, 'get id');
verifyNotEnumerable(getter, 'name');
verifyNotWritable(getter, 'name');
verifyConfigurable(getter, 'name');
verifyProperty(getter, 'name', {
value: 'get id',
writable: false,
enumerable: false,
configurable: true,
});
getter = Object.getOwnPropertyDescriptor(A, anonSym).get;
assert.sameValue(getter.name, 'get ');
verifyNotEnumerable(getter, 'name');
verifyNotWritable(getter, 'name');
verifyConfigurable(getter, 'name');
verifyProperty(getter, 'name', {
value: 'get ',
writable: false,
enumerable: false,
configurable: true,
});
getter = Object.getOwnPropertyDescriptor(A, namedSym).get;
assert.sameValue(getter.name, 'get [test262]');
verifyNotEnumerable(getter, 'name');
verifyNotWritable(getter, 'name');
verifyConfigurable(getter, 'name');
verifyProperty(getter, 'name', {
value: 'get [test262]',
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -28,37 +28,49 @@ class A {
}
setter = Object.getOwnPropertyDescriptor(A.prototype, 'id').set;
assert.sameValue(setter.name, 'set id');
verifyNotEnumerable(setter, 'name');
verifyNotWritable(setter, 'name');
verifyConfigurable(setter, 'name');
verifyProperty(setter, 'name', {
value: 'set id',
writable: false,
enumerable: false,
configurable: true,
});
setter = Object.getOwnPropertyDescriptor(A.prototype, anonSym).set;
assert.sameValue(setter.name, 'set ');
verifyNotEnumerable(setter, 'name');
verifyNotWritable(setter, 'name');
verifyConfigurable(setter, 'name');
verifyProperty(setter, 'name', {
value: 'set ',
writable: false,
enumerable: false,
configurable: true,
});
setter = Object.getOwnPropertyDescriptor(A.prototype, namedSym).set;
assert.sameValue(setter.name, 'set [test262]');
verifyNotEnumerable(setter, 'name');
verifyNotWritable(setter, 'name');
verifyConfigurable(setter, 'name');
verifyProperty(setter, 'name', {
value: 'set [test262]',
writable: false,
enumerable: false,
configurable: true,
});
setter = Object.getOwnPropertyDescriptor(A, 'id').set;
assert.sameValue(setter.name, 'set id');
verifyNotEnumerable(setter, 'name');
verifyNotWritable(setter, 'name');
verifyConfigurable(setter, 'name');
verifyProperty(setter, 'name', {
value: 'set id',
writable: false,
enumerable: false,
configurable: true,
});
setter = Object.getOwnPropertyDescriptor(A, anonSym).set;
assert.sameValue(setter.name, 'set ');
verifyNotEnumerable(setter, 'name');
verifyNotWritable(setter, 'name');
verifyConfigurable(setter, 'name');
verifyProperty(setter, 'name', {
value: 'set ',
writable: false,
enumerable: false,
configurable: true,
});
setter = Object.getOwnPropertyDescriptor(A, namedSym).set;
assert.sameValue(setter.name, 'set [test262]');
verifyNotEnumerable(setter, 'name');
verifyNotWritable(setter, 'name');
verifyConfigurable(setter, 'name');
verifyProperty(setter, 'name', {
value: 'set [test262]',
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -27,32 +27,44 @@ class A {
static *[namedSym]() {}
}
assert.sameValue(A.prototype.id.name, 'id', 'via IdentifierName');
verifyNotEnumerable(A.prototype.id, 'name');
verifyNotWritable(A.prototype.id, 'name');
verifyConfigurable(A.prototype.id, 'name');
verifyProperty(A.prototype.id, 'name', {
value: 'id',
writable: false,
enumerable: false,
configurable: true,
});
assert.sameValue(A.prototype[anonSym].name, '', 'via anonymous Symbol');
verifyNotEnumerable(A.prototype[anonSym], 'name');
verifyNotWritable(A.prototype[anonSym], 'name');
verifyConfigurable(A.prototype[anonSym], 'name');
verifyProperty(A.prototype[anonSym], 'name', {
value: '',
writable: false,
enumerable: false,
configurable: true,
});
assert.sameValue(A.prototype[namedSym].name, '[test262]', 'via Symbol');
verifyNotEnumerable(A.prototype[namedSym], 'name');
verifyNotWritable(A.prototype[namedSym], 'name');
verifyConfigurable(A.prototype[namedSym], 'name');
verifyProperty(A.prototype[namedSym], 'name', {
value: '[test262]',
writable: false,
enumerable: false,
configurable: true,
});
assert.sameValue(A.id.name, 'id', 'static via IdentifierName');
verifyNotEnumerable(A.id, 'name');
verifyNotWritable(A.id, 'name');
verifyConfigurable(A.id, 'name');
verifyProperty(A.id, 'name', {
value: 'id',
writable: false,
enumerable: false,
configurable: true,
});
assert.sameValue(A[anonSym].name, '', 'static via anonymous Symbol');
verifyNotEnumerable(A[anonSym], 'name');
verifyNotWritable(A[anonSym], 'name');
verifyConfigurable(A[anonSym], 'name');
verifyProperty(A[anonSym], 'name', {
value: '',
writable: false,
enumerable: false,
configurable: true,
});
assert.sameValue(A[namedSym].name, '[test262]', 'static via Symbol');
verifyNotEnumerable(A[namedSym], 'name');
verifyNotWritable(A[namedSym], 'name');
verifyConfigurable(A[namedSym], 'name');
verifyProperty(A[namedSym], 'name', {
value: '[test262]',
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -26,32 +26,44 @@ class A {
static [namedSym]() {}
}
assert.sameValue(A.prototype.id.name, 'id', 'via IdentifierName');
verifyNotEnumerable(A.prototype.id, 'name');
verifyNotWritable(A.prototype.id, 'name');
verifyConfigurable(A.prototype.id, 'name');
verifyProperty(A.prototype.id, 'name', {
value: 'id',
writable: false,
enumerable: false,
configurable: true,
});
assert.sameValue(A.prototype[anonSym].name, '', 'via anonymous Symbol');
verifyNotEnumerable(A.prototype[anonSym], 'name');
verifyNotWritable(A.prototype[anonSym], 'name');
verifyConfigurable(A.prototype[anonSym], 'name');
verifyProperty(A.prototype[anonSym], 'name', {
value: '',
writable: false,
enumerable: false,
configurable: true,
});
assert.sameValue(A.prototype[namedSym].name, '[test262]', 'via Symbol');
verifyNotEnumerable(A.prototype[namedSym], 'name');
verifyNotWritable(A.prototype[namedSym], 'name');
verifyConfigurable(A.prototype[namedSym], 'name');
verifyProperty(A.prototype[namedSym], 'name', {
value: '[test262]',
writable: false,
enumerable: false,
configurable: true,
});
assert.sameValue(A.id.name, 'id', 'static via IdentifierName');
verifyNotEnumerable(A.id, 'name');
verifyNotWritable(A.id, 'name');
verifyConfigurable(A.id, 'name');
verifyProperty(A.id, 'name', {
value: 'id',
writable: false,
enumerable: false,
configurable: true,
});
assert.sameValue(A[anonSym].name, '', 'static via anonymous Symbol');
verifyNotEnumerable(A[anonSym], 'name');
verifyNotWritable(A[anonSym], 'name');
verifyConfigurable(A[anonSym], 'name');
verifyProperty(A[anonSym], 'name', {
value: '',
writable: false,
enumerable: false,
configurable: true,
});
assert.sameValue(A[namedSym].name, '[test262]', 'static via Symbol');
verifyNotEnumerable(A[namedSym], 'name');
verifyNotWritable(A[namedSym], 'name');
verifyConfigurable(A[namedSym], 'name');
verifyProperty(A[namedSym], 'name', {
value: '[test262]',
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -9,8 +9,10 @@ includes: [propertyHelper.js]
function assertGetterDescriptor(object, name) {
var desc = Object.getOwnPropertyDescriptor(object, name);
verifyNotEnumerable(object, name);
verifyConfigurable(object, name);
verifyProperty(object, name, {
enumerable: false,
configurable: true,
});
assert.sameValue(typeof desc.get, 'function', "`typeof desc.get` is `'function'`");
assert.sameValue('prototype' in desc.get, false, "The result of `'prototype' in desc.get` is `false`");
assert.sameValue(desc.set, undefined, "The value of `desc.set` is `undefined`");

View File

@ -9,8 +9,10 @@ includes: [propertyHelper.js]
function assertSetterDescriptor(object, name) {
var descr = Object.getOwnPropertyDescriptor(object, name);
verifyNotEnumerable(object, name);
verifyConfigurable(object, name);
verifyProperty(object, name, {
enumerable: false,
configurable: true,
});
assert.sameValue(typeof descr.set, 'function', "`typeof descr.set` is `'function'`");
assert.sameValue('prototype' in descr.set, false, "The result of `'prototype' in descr.set` is `false`");
assert.sameValue(descr.get, undefined, "The value of `descr.get` is `undefined`");

View File

@ -34,34 +34,42 @@ class C1 { *m(x = 42) {} }
var m1 = C1.prototype.m;
assert.sameValue(m1.length, 0, 'formalslist: x = 42');
verifyNotEnumerable(m1, 'length');
verifyNotWritable(m1, 'length');
verifyConfigurable(m1, 'length');
verifyProperty(m1, "length", {
value: 0,
writable: false,
enumerable: false,
configurable: true,
});
class C2 { *m(x = 42, y) {} }
var m2 = C2.prototype.m;
assert.sameValue(m2.length, 0, 'formalslist: x = 42, y');
verifyNotEnumerable(m2, 'length');
verifyNotWritable(m2, 'length');
verifyConfigurable(m2, 'length');
verifyProperty(m2, "length", {
value: 0,
writable: false,
enumerable: false,
configurable: true,
});
class C3 { *m(x, y = 42) {} }
var m3 = C3.prototype.m;
assert.sameValue(m3.length, 1, 'formalslist: x, y = 42');
verifyNotEnumerable(m3, 'length');
verifyNotWritable(m3, 'length');
verifyConfigurable(m3, 'length');
verifyProperty(m3, "length", {
value: 1,
writable: false,
enumerable: false,
configurable: true,
});
class C4 { *m(x, y = 42, z) {} }
var m4 = C4.prototype.m;
assert.sameValue(m4.length, 1, 'formalslist: x, y = 42, z');
verifyNotEnumerable(m4, 'length');
verifyNotWritable(m4, 'length');
verifyConfigurable(m4, 'length');
verifyProperty(m4, "length", {
value: 1,
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -34,34 +34,42 @@ class C1 { m(x = 42) {} }
var m1 = C1.prototype.m;
assert.sameValue(m1.length, 0, 'formalslist: x = 42');
verifyNotEnumerable(m1, 'length');
verifyNotWritable(m1, 'length');
verifyConfigurable(m1, 'length');
verifyProperty(m1, "length", {
value: 0,
writable: false,
enumerable: false,
configurable: true,
});
class C2 { m(x = 42, y) {} }
var m2 = C2.prototype.m;
assert.sameValue(m2.length, 0, 'formalslist: x = 42, y');
verifyNotEnumerable(m2, 'length');
verifyNotWritable(m2, 'length');
verifyConfigurable(m2, 'length');
verifyProperty(m2, "length", {
value: 0,
writable: false,
enumerable: false,
configurable: true,
});
class C3 { m(x, y = 42) {} }
var m3 = C3.prototype.m;
assert.sameValue(m3.length, 1, 'formalslist: x, y = 42');
verifyNotEnumerable(m3, 'length');
verifyNotWritable(m3, 'length');
verifyConfigurable(m3, 'length');
verifyProperty(m3, "length", {
value: 1,
writable: false,
enumerable: false,
configurable: true,
});
class C4 { m(x, y = 42, z) {} }
var m4 = C4.prototype.m;
assert.sameValue(m4.length, 1, 'formalslist: x, y = 42, z');
verifyNotEnumerable(m4, 'length');
verifyNotWritable(m4, 'length');
verifyConfigurable(m4, 'length');
verifyProperty(m4, "length", {
value: 1,
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -15,7 +15,9 @@ includes: [propertyHelper.js]
class Test262 {}
assert.sameValue(Test262.name, 'Test262');
verifyNotEnumerable(Test262, 'name');
verifyNotWritable(Test262, 'name');
verifyConfigurable(Test262, 'name');
verifyProperty(Test262, "name", {
value: "Test262",
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -33,7 +33,9 @@ includes: [propertyHelper.js]
class C { set m(x = 42) {} }
var set = Object.getOwnPropertyDescriptor(C.prototype, 'm').set;
assert.sameValue(set.length, 0, 'FormalsList: x = 42');
verifyNotEnumerable(set, 'length');
verifyNotWritable(set, 'length');
verifyConfigurable(set, 'length');
verifyProperty(set, 'length', {
value: 0,
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -34,34 +34,42 @@ class C1 { static m(x = 42) {} }
var m1 = C1.m;
assert.sameValue(m1.length, 0, 'formalslist: x = 42');
verifyNotEnumerable(m1, 'length');
verifyNotWritable(m1, 'length');
verifyConfigurable(m1, 'length');
verifyProperty(m1, "length", {
value: 0,
writable: false,
enumerable: false,
configurable: true,
});
class C2 { static m(x = 42, y) {} }
var m2 = C2.m;
assert.sameValue(m2.length, 0, 'formalslist: x = 42, y');
verifyNotEnumerable(m2, 'length');
verifyNotWritable(m2, 'length');
verifyConfigurable(m2, 'length');
verifyProperty(m2, "length", {
value: 0,
writable: false,
enumerable: false,
configurable: true,
});
class C3 { static m(x, y = 42) {} }
var m3 = C3.m;
assert.sameValue(m3.length, 1, 'formalslist: x, y = 42');
verifyNotEnumerable(m3, 'length');
verifyNotWritable(m3, 'length');
verifyConfigurable(m3, 'length');
verifyProperty(m3, "length", {
value: 1,
writable: false,
enumerable: false,
configurable: true,
});
class C4 { static m(x, y = 42, z) {} }
var m4 = C4.m;
assert.sameValue(m4.length, 1, 'formalslist: x, y = 42, z');
verifyNotEnumerable(m4, 'length');
verifyNotWritable(m4, 'length');
verifyConfigurable(m4, 'length');
verifyProperty(m4, "length", {
value: 1,
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -24,12 +24,13 @@ class Err extends Error {}
Err.prototype.message = 'custom-error';
var err1 = new Err('foo 42');
assert.sameValue(err1.message, 'foo 42');
assert(err1.hasOwnProperty('message'));
verifyWritable(err1, 'message');
verifyNotEnumerable(err1, 'message');
verifyConfigurable(err1, 'message');
verifyProperty(err1, 'message', {
value: 'foo 42',
writable: true,
enumerable: false,
configurable: true,
});
var err2 = new Err();
assert.sameValue(err2.hasOwnProperty('message'), false);

View File

@ -20,8 +20,9 @@ class Fn extends Function {}
var fn = new Fn('a', 'b', 'return a + b');
assert.sameValue(fn.length, 2);
verifyNotEnumerable(fn, 'length');
verifyNotWritable(fn, 'length');
verifyConfigurable(fn, 'length');
verifyProperty(fn, 'length', {
value: 2,
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -29,11 +29,9 @@ class Fn extends Function {}
var fn = new Fn('a', 'b', 'return a + b');
assert.sameValue(
fn.name, 'anonymous',
'Dynamic Functions are called anonymous'
);
verifyNotEnumerable(fn, 'name');
verifyNotWritable(fn, 'name');
verifyConfigurable(fn, 'name');
verifyProperty(fn, 'name', {
value: 'anonymous',
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -24,8 +24,9 @@ class GFn extends GeneratorFunction {}
var gfn = new GFn('a', 'b', 'return a + b');
assert.sameValue(gfn.length, 2);
verifyNotEnumerable(gfn, 'length');
verifyNotWritable(gfn, 'length');
verifyConfigurable(gfn, 'length');
verifyProperty(gfn, 'length', {
value: 2,
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -36,11 +36,9 @@ class GFn extends GeneratorFunction {}
var gfn = new GFn('a', 'b', 'return a + b');
assert.sameValue(
gfn.name, 'anonymous',
'Dynamic Functions are called anonymous'
);
verifyNotEnumerable(gfn, 'name');
verifyNotWritable(gfn, 'name');
verifyConfigurable(gfn, 'name');
verifyProperty(gfn, 'name', {
value: 'anonymous',
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -33,6 +33,8 @@ assert.sameValue(
'prototype has no constructor reference'
);
verifyNotEnumerable(gfn, 'prototype');
verifyWritable(gfn, 'prototype');
verifyNotConfigurable(gfn, 'prototype');
verifyProperty(gfn, 'prototype', {
writable: true,
enumerable: false,
configurable: false,
});

View File

@ -23,12 +23,13 @@ class Err extends EvalError {}
Err.prototype.message = 'custom-eval-error';
var err1 = new Err('foo 42');
assert.sameValue(err1.message, 'foo 42');
assert(err1.hasOwnProperty('message'));
verifyWritable(err1, 'message');
verifyNotEnumerable(err1, 'message');
verifyConfigurable(err1, 'message');
verifyProperty(err1, 'message', {
value: 'foo 42',
writable: true,
enumerable: false,
configurable: true,
});
var err2 = new Err();
assert.sameValue(err2.hasOwnProperty('message'), false);

View File

@ -23,12 +23,13 @@ class Err extends RangeError {}
Err.prototype.message = 'custom-range-error';
var err1 = new Err('foo 42');
assert.sameValue(err1.message, 'foo 42');
assert(err1.hasOwnProperty('message'));
verifyWritable(err1, 'message');
verifyNotEnumerable(err1, 'message');
verifyConfigurable(err1, 'message');
verifyProperty(err1, 'message', {
value: 'foo 42',
writable: true,
enumerable: false,
configurable: true,
});
var err2 = new Err();
assert.sameValue(err2.hasOwnProperty('message'), false);

View File

@ -23,12 +23,13 @@ class Err extends ReferenceError {}
Err.prototype.message = 'custom-reference-error';
var err1 = new Err('foo 42');
assert.sameValue(err1.message, 'foo 42');
assert(err1.hasOwnProperty('message'));
verifyWritable(err1, 'message');
verifyNotEnumerable(err1, 'message');
verifyConfigurable(err1, 'message');
verifyProperty(err1, 'message', {
value: 'foo 42',
writable: true,
enumerable: false,
configurable: true,
});
var err2 = new Err();
assert.sameValue(err2.hasOwnProperty('message'), false);

View File

@ -23,12 +23,13 @@ class Err extends SyntaxError {}
Err.prototype.message = 'custom-syntax-error';
var err1 = new Err('foo 42');
assert.sameValue(err1.message, 'foo 42');
assert(err1.hasOwnProperty('message'));
verifyWritable(err1, 'message');
verifyNotEnumerable(err1, 'message');
verifyConfigurable(err1, 'message');
verifyProperty(err1, 'message', {
value: 'foo 42',
writable: true,
enumerable: false,
configurable: true,
});
var err2 = new Err();
assert.sameValue(err2.hasOwnProperty('message'), false);

View File

@ -23,12 +23,13 @@ class Err extends TypeError {}
Err.prototype.message = 'custom-type-error';
var err1 = new Err('foo 42');
assert.sameValue(err1.message, 'foo 42');
assert(err1.hasOwnProperty('message'));
verifyWritable(err1, 'message');
verifyNotEnumerable(err1, 'message');
verifyConfigurable(err1, 'message');
verifyProperty(err1, 'message', {
value: 'foo 42',
writable: true,
enumerable: false,
configurable: true,
});
var err2 = new Err();
assert.sameValue(err2.hasOwnProperty('message'), false);

View File

@ -23,12 +23,13 @@ class Err extends URIError {}
Err.prototype.message = 'custom-uri-error';
var err1 = new Err('foo 42');
assert.sameValue(err1.message, 'foo 42');
assert(err1.hasOwnProperty('message'));
verifyWritable(err1, 'message');
verifyNotEnumerable(err1, 'message');
verifyConfigurable(err1, 'message');
verifyProperty(err1, 'message', {
value: 'foo 42',
writable: true,
enumerable: false,
configurable: true,
});
var err2 = new Err();
assert.sameValue(err2.hasOwnProperty('message'), false);

View File

@ -19,8 +19,9 @@ var re = new RE('39?');
re.exec('TC39');
assert.sameValue(re.lastIndex, 0);
verifyWritable(re, 'lastIndex');
verifyNotEnumerable(re, 'lastIndex');
verifyNotConfigurable(re, 'lastIndex');
verifyProperty(re, 'lastIndex', {
value: 0,
writable: true,
enumerable: false,
configurable: false,
});

View File

@ -16,15 +16,19 @@ includes: [propertyHelper.js]
class S extends String {}
var s1 = new S();
assert.sameValue(s1.length, 0);
verifyNotWritable(s1, 'length');
verifyNotEnumerable(s1, 'length');
verifyNotConfigurable(s1, 'length');
verifyProperty(s1, 'length', {
value: 0,
writable: false,
enumerable: false,
configurable: false,
});
var s2 = new S('test262');
assert.sameValue(s2.length, 7);
verifyNotWritable(s2, 'length');
verifyNotEnumerable(s2, 'length');
verifyNotConfigurable(s2, 'length');
verifyProperty(s2, 'length', {
value: 7,
writable: false,
enumerable: false,
configurable: false,
});

View File

@ -18,7 +18,9 @@ includes: [propertyHelper.js]
const arrow = () => {};
assert.sameValue(arrow.name, 'arrow');
verifyNotEnumerable(arrow, 'name');
verifyNotWritable(arrow, 'name');
verifyConfigurable(arrow, 'name');
verifyProperty(arrow, "name", {
value: "arrow",
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -24,7 +24,9 @@ const xCls2 = class { static name() {} };
assert.notSameValue(xCls.name, 'xCls');
assert.notSameValue(xCls2.name, 'xCls2');
assert.sameValue(cls.name, 'cls');
verifyNotEnumerable(cls, 'name');
verifyNotWritable(cls, 'name');
verifyConfigurable(cls, 'name');
verifyProperty(cls, 'name', {
value: 'cls',
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -22,7 +22,9 @@ const cover = (function() {});
assert(xCover.name !== 'xCover');
assert.sameValue(cover.name, 'cover');
verifyNotEnumerable(cover, 'name');
verifyNotWritable(cover, 'name');
verifyConfigurable(cover, 'name');
verifyProperty(cover, 'name', {
value: 'cover',
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -21,7 +21,9 @@ const fn = function() {};
assert(xFn.name !== 'xFn');
assert.sameValue(fn.name, 'fn');
verifyNotEnumerable(fn, 'name');
verifyNotWritable(fn, 'name');
verifyConfigurable(fn, 'name');
verifyProperty(fn, 'name', {
value: 'fn',
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -22,7 +22,9 @@ const gen = function*() {};
assert(xGen.name !== 'xGen');
assert.sameValue(gen.name, 'gen');
verifyNotEnumerable(gen, 'name');
verifyNotWritable(gen, 'name');
verifyConfigurable(gen, 'name');
verifyProperty(gen, 'name', {
value: 'gen',
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -11,9 +11,9 @@ includes: [propertyHelper.js]
var fun = function (x, y) { };
assert(fun.hasOwnProperty("length"));
assert.sameValue(fun.length, 2);
verifyNotEnumerable(fun, "length");
verifyNotWritable(fun, "length");
verifyConfigurable(fun, "length");
verifyProperty(fun, "length", {
value: 2,
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -30,9 +30,11 @@ try {
assert.notSameValue(fun.prototype, 100);
assert.sameValue(fun.prototype.toString(), "[object Object]");
verifyNotEnumerable(fun, "prototype");
verifyWritable(fun, "prototype");
verifyNotConfigurable(fun, "prototype");
verifyProperty(fun, "prototype", {
writable: true,
enumerable: false,
configurable: false,
});
assert.sameValue(data, "data");
} finally {

View File

@ -33,28 +33,36 @@ includes: [propertyHelper.js]
function f1(x = 42) {}
assert.sameValue(f1.length, 0, 'FormalsList: x = 42');
verifyNotEnumerable(f1, 'length');
verifyNotWritable(f1, 'length');
verifyConfigurable(f1, 'length');
verifyProperty(f1, "length", {
value: 0,
writable: false,
enumerable: false,
configurable: true,
});
function f2(x = 42, y) {}
assert.sameValue(f2.length, 0, 'FormalsList: x = 42, y');
verifyNotEnumerable(f2, 'length');
verifyNotWritable(f2, 'length');
verifyConfigurable(f2, 'length');
verifyProperty(f2, "length", {
value: 0,
writable: false,
enumerable: false,
configurable: true,
});
function f3(x, y = 42) {}
assert.sameValue(f3.length, 1, 'FormalsList: x, y = 42');
verifyNotEnumerable(f3, 'length');
verifyNotWritable(f3, 'length');
verifyConfigurable(f3, 'length');
verifyProperty(f3, "length", {
value: 1,
writable: false,
enumerable: false,
configurable: true,
});
function f4(x, y = 42, z) {}
assert.sameValue(f4.length, 1, 'FormalsList: x, y = 42, z');
verifyNotEnumerable(f4, 'length');
verifyNotWritable(f4, 'length');
verifyConfigurable(f4, 'length');
verifyProperty(f4, "length", {
value: 1,
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -18,7 +18,9 @@ includes: [propertyHelper.js]
function func() {}
assert.sameValue(func.name, 'func');
verifyNotEnumerable(func, 'name');
verifyNotWritable(func, 'name');
verifyConfigurable(func, 'name');
verifyProperty(func, "name", {
value: "func",
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -33,28 +33,36 @@ includes: [propertyHelper.js]
function* f1(x = 42) {}
assert.sameValue(f1.length, 0, 'FormalsList: x = 42');
verifyNotEnumerable(f1, 'length');
verifyNotWritable(f1, 'length');
verifyConfigurable(f1, 'length');
verifyProperty(f1, "length", {
value: 0,
writable: false,
enumerable: false,
configurable: true,
});
function* f2(x = 42, y) {}
assert.sameValue(f2.length, 0, 'FormalsList: x = 42, y');
verifyNotEnumerable(f2, 'length');
verifyNotWritable(f2, 'length');
verifyConfigurable(f2, 'length');
verifyProperty(f2, "length", {
value: 0,
writable: false,
enumerable: false,
configurable: true,
});
function* f3(x, y = 42) {}
assert.sameValue(f3.length, 1, 'FormalsList: x, y = 42');
verifyNotEnumerable(f3, 'length');
verifyNotWritable(f3, 'length');
verifyConfigurable(f3, 'length');
verifyProperty(f3, "length", {
value: 1,
writable: false,
enumerable: false,
configurable: true,
});
function* f4(x, y = 42, z) {}
assert.sameValue(f4.length, 1, 'FormalsList: x, y = 42, z');
verifyNotEnumerable(f4, 'length');
verifyNotWritable(f4, 'length');
verifyConfigurable(f4, 'length');
verifyProperty(f4, "length", {
value: 1,
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -11,7 +11,9 @@ features: [generators]
function* g() {}
assert.sameValue(g.length, 0);
verifyNotEnumerable(g, 'length');
verifyNotWritable(g, 'length');
verifyConfigurable(g, 'length');
verifyProperty(g, "length", {
value: 0,
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -16,7 +16,9 @@ features: [generators]
function* g() {}
assert.sameValue(g.name, 'g');
verifyNotEnumerable(g, 'name');
verifyNotWritable(g, 'name');
verifyConfigurable(g, 'name');
verifyProperty(g, "name", {
value: "g",
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -11,6 +11,8 @@ features: [generators]
function* g() {}
verifyNotEnumerable(g, 'prototype');
verifyWritable(g, 'prototype');
verifyNotConfigurable(g, 'prototype');
verifyProperty(g, "prototype", {
writable: true,
enumerable: false,
configurable: false,
});

View File

@ -18,7 +18,9 @@ includes: [propertyHelper.js]
let arrow = () => {};
assert.sameValue(arrow.name, 'arrow');
verifyNotEnumerable(arrow, 'name');
verifyNotWritable(arrow, 'name');
verifyConfigurable(arrow, 'name');
verifyProperty(arrow, 'name', {
value: 'arrow',
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -24,7 +24,9 @@ let xCls2 = class { static name() {} };
assert.notSameValue(xCls.name, 'xCls');
assert.notSameValue(xCls2.name, 'xCls2');
assert.sameValue(cls.name, 'cls');
verifyNotEnumerable(cls, 'name');
verifyNotWritable(cls, 'name');
verifyConfigurable(cls, 'name');
verifyProperty(cls, 'name', {
value: 'cls',
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -22,7 +22,9 @@ let cover = (function() {});
assert(xCover.name !== 'xCover');
assert.sameValue(cover.name, 'cover');
verifyNotEnumerable(cover, 'name');
verifyNotWritable(cover, 'name');
verifyConfigurable(cover, 'name');
verifyProperty(cover, 'name', {
value: 'cover',
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -21,7 +21,9 @@ let fn = function() {};
assert(xFn.name !== 'xFn');
assert.sameValue(fn.name, 'fn');
verifyNotEnumerable(fn, 'name');
verifyNotWritable(fn, 'name');
verifyConfigurable(fn, 'name');
verifyProperty(fn, 'name', {
value: 'fn',
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -22,7 +22,9 @@ let gen = function*() {};
assert(xGen.name !== 'xGen');
assert.sameValue(gen.name, 'gen');
verifyNotEnumerable(gen, 'name');
verifyNotWritable(gen, 'name');
verifyConfigurable(gen, 'name');
verifyProperty(gen, 'name', {
value: 'gen',
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -18,7 +18,9 @@ includes: [propertyHelper.js]
var arrow = () => {};
assert.sameValue(arrow.name, 'arrow');
verifyNotEnumerable(arrow, 'name');
verifyNotWritable(arrow, 'name');
verifyConfigurable(arrow, 'name');
verifyProperty(arrow, 'name', {
value: 'arrow',
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -24,7 +24,9 @@ var xCls2 = class { static name() {} };
assert.notSameValue(xCls.name, 'xCls');
assert.notSameValue(xCls2.name, 'xCls2');
assert.sameValue(cls.name, 'cls');
verifyNotEnumerable(cls, 'name');
verifyNotWritable(cls, 'name');
verifyConfigurable(cls, 'name');
verifyProperty(cls, 'name', {
value: 'cls',
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -22,7 +22,9 @@ var cover = (function() {});
assert(xCover.name !== 'xCover');
assert.sameValue(cover.name, 'cover');
verifyNotEnumerable(cover, 'name');
verifyNotWritable(cover, 'name');
verifyConfigurable(cover, 'name');
verifyProperty(cover, 'name', {
value: 'cover',
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -21,7 +21,9 @@ var fn = function() {};
assert(xFn.name !== 'xFn');
assert.sameValue(fn.name, 'fn');
verifyNotEnumerable(fn, 'name');
verifyNotWritable(fn, 'name');
verifyConfigurable(fn, 'name');
verifyProperty(fn, 'name', {
value: 'fn',
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -22,7 +22,9 @@ var gen = function*() {};
assert(xGen.name !== 'xGen');
assert.sameValue(gen.name, 'gen');
verifyNotEnumerable(gen, 'name');
verifyNotWritable(gen, 'name');
verifyConfigurable(gen, 'name');
verifyProperty(gen, 'name', {
value: 'gen',
writable: false,
enumerable: false,
configurable: true,
});