mirror of https://github.com/tc39/test262.git
Remove built-ins/NativeErrors/AggregateError/prototype/errors
The `errors` property accessors has been removed from the spec proposal.
This commit is contained in:
parent
630f7dee66
commit
660a3d6512
|
@ -1,21 +0,0 @@
|
|||
// Copyright (C) 2019 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-aggregate-error.prototype.errors
|
||||
description: >
|
||||
Requires this value to have a [[AggregateErrorData]] internal slot
|
||||
info: |
|
||||
get AggregateError.prototype.errors
|
||||
|
||||
1. Let E be the this value.
|
||||
2. If Type(E) is not Object, throw a TypeError exception.
|
||||
3. If E does not have an [[ErrorData]] internal slot, throw a TypeError exception.
|
||||
4. If E does not have an [[AggregateErrors]] internal slot, throw a TypeError exception.
|
||||
5. Return ! CreateArrayFromList(E.[[AggregateErrors]]).
|
||||
features: [AggregateError]
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
AggregateError.prototype.errors;
|
||||
});
|
|
@ -1,25 +0,0 @@
|
|||
// Copyright (C) 2019 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-aggregate-error.prototype.errors
|
||||
description: >
|
||||
Throws a TypeError exception when invoked as a function
|
||||
info: |
|
||||
get AggregateError.prototype.errors
|
||||
|
||||
1. Let E be the this value.
|
||||
2. If Type(E) is not Object, throw a TypeError exception.
|
||||
3. If E does not have an [[ErrorData]] internal slot, throw a TypeError exception.
|
||||
4. If E does not have an [[AggregateErrors]] internal slot, throw a TypeError exception.
|
||||
5. Return ! CreateArrayFromList(E.[[AggregateErrors]]).
|
||||
features: [AggregateError]
|
||||
---*/
|
||||
|
||||
var getter = Object.getOwnPropertyDescriptor(
|
||||
AggregateError.prototype, 'errors'
|
||||
).get;
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
getter();
|
||||
});
|
|
@ -1,33 +0,0 @@
|
|||
// Copyright (C) 2019 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-aggregate-error.prototype.errors
|
||||
description: >
|
||||
Property descriptor of (get AggregateError.prototype.errors).length
|
||||
info: |
|
||||
get AggregateError.prototype.errors
|
||||
|
||||
17 ECMAScript Standard Built-in Objects:
|
||||
Every built-in Function object, including constructors, has a length
|
||||
property whose value is an integer. Unless otherwise specified, this
|
||||
value is equal to the largest number of named arguments shown in the
|
||||
subclause headings for the function description, including optional
|
||||
parameters. However, rest parameters shown using the form “...name”
|
||||
are not included in the default argument count.
|
||||
|
||||
Unless otherwise specified, the length property of a built-in Function
|
||||
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
|
||||
[[Configurable]]: true }.
|
||||
includes: [propertyHelper.js]
|
||||
features: [AggregateError]
|
||||
---*/
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(AggregateError.prototype, 'errors');
|
||||
|
||||
verifyProperty(desc.get, 'length', {
|
||||
value: 0,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true
|
||||
});
|
|
@ -1,28 +0,0 @@
|
|||
// Copyright (C) 2019 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-aggregate-error.prototype.errors
|
||||
description: >
|
||||
Property descriptor of (get AggregateError.prototype.errors).name
|
||||
info: |
|
||||
get AggregateError.prototype.errors
|
||||
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
|
||||
Functions that are specified as get or set accessor functions of built-in
|
||||
properties have "get " or "set " prepended to the property name string.
|
||||
includes: [propertyHelper.js]
|
||||
features: [AggregateError]
|
||||
---*/
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(
|
||||
AggregateError.prototype, 'errors'
|
||||
);
|
||||
|
||||
verifyProperty(desc.get, 'name', {
|
||||
value: 'get errors',
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true
|
||||
});
|
|
@ -1,25 +0,0 @@
|
|||
// Copyright (C) 2019 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-get-aggregate-error.prototype.errors
|
||||
description: >
|
||||
"errors" property of AggregateError.prototype
|
||||
info: |
|
||||
AggregateError.prototype.errors is an accessor property whose set accessor
|
||||
function is undefined.
|
||||
|
||||
Section 17: Every accessor property described in clauses 18 through 26 and in
|
||||
Annex B.2 has the attributes {[[Enumerable]]: false, [[Configurable]]: true }
|
||||
includes: [propertyHelper.js]
|
||||
features: [AggregateError]
|
||||
---*/
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(AggregateError.prototype, 'errors');
|
||||
|
||||
assert.sameValue(desc.set, undefined);
|
||||
assert.sameValue(typeof desc.get, 'function');
|
||||
|
||||
verifyProperty(AggregateError.prototype, 'errors', {
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
|
@ -1,51 +0,0 @@
|
|||
// Copyright (C) 2019 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-get-aggregate-error.prototype.errors
|
||||
description: >
|
||||
Return a new array from the [[AggregateErrors]] list, after an iterable errors arg.
|
||||
info: |
|
||||
get AggregateError.prototype.errors
|
||||
|
||||
1. Let E be the this value.
|
||||
...
|
||||
5. Return ! CreateArrayFromList(E.[[AggregateErrors]]).
|
||||
includes: [compareArray.js]
|
||||
features: [AggregateError, Symbol.iterator]
|
||||
---*/
|
||||
|
||||
var count = 0;
|
||||
var errors = {
|
||||
[Symbol.iterator]() {
|
||||
return {
|
||||
next() {
|
||||
count += 1;
|
||||
return {
|
||||
done: count === 3,
|
||||
get value() {
|
||||
return count * 3;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
var case1 = new AggregateError(errors);
|
||||
|
||||
assert.sameValue(count, 3);
|
||||
|
||||
var get1 = case1.errors;
|
||||
var get2 = case1.errors;
|
||||
|
||||
assert.sameValue(Array.isArray(get1), true);
|
||||
assert.sameValue(Array.isArray(get2), true);
|
||||
|
||||
assert.notSameValue(get1, errors, 'creates a new array #1');
|
||||
assert.notSameValue(get2, errors, 'creates a new array #2');
|
||||
assert.notSameValue(get1, get2, 'creates a new array everytime it gets the values');
|
||||
|
||||
assert.compareArray(get1, [3, 6], 'get accessor does not trigger a new iteration #1');
|
||||
assert.compareArray(get2, [3, 6], 'get accessor does not trigger a new iteration #2');
|
||||
|
||||
assert.sameValue(count, 3, 'count is preserved');
|
|
@ -1,76 +0,0 @@
|
|||
// Copyright (C) 2019 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-get-aggregate-error.prototype.errors
|
||||
description: >
|
||||
Return a new array from the [[AggregateErrors]] list.
|
||||
info: |
|
||||
get AggregateError.prototype.errors
|
||||
|
||||
1. Let E be the this value.
|
||||
...
|
||||
5. Return ! CreateArrayFromList(E.[[AggregateErrors]]).
|
||||
includes: [compareArray.js]
|
||||
features: [AggregateError, Symbol]
|
||||
---*/
|
||||
|
||||
var errors = [];
|
||||
var case1 = new AggregateError(errors);
|
||||
var case1get1 = case1.errors;
|
||||
var case1get2 = case1.errors;
|
||||
|
||||
assert.sameValue(Array.isArray(case1get1), true);
|
||||
assert.sameValue(Array.isArray(case1get2), true);
|
||||
|
||||
assert.notSameValue(case1get1, errors, 'case1 - creates a new array #1');
|
||||
assert.notSameValue(case1get2, errors, 'case1 - creates a new array #2');
|
||||
assert.notSameValue(case1get1, case1get2, 'creates a new array everytime it gets the values');
|
||||
|
||||
assert.compareArray(case1get1, errors);
|
||||
assert.compareArray(case1get2, errors);
|
||||
|
||||
/////
|
||||
|
||||
errors = [undefined, null, 1, 0, '', {}, Symbol()];
|
||||
var case2 = new AggregateError(errors);
|
||||
var case2get1 = case2.errors;
|
||||
var case2get2 = case2.errors;
|
||||
|
||||
assert.sameValue(Array.isArray(case2get1), true);
|
||||
assert.sameValue(Array.isArray(case2get2), true);
|
||||
|
||||
assert.notSameValue(case2get1, errors, 'case2 - creates a new array #1');
|
||||
assert.notSameValue(case2get2, errors, 'case2 - creates a new array #2');
|
||||
assert.notSameValue(case2get1, case2get2, 'creates a new array everytime it gets the values');
|
||||
|
||||
assert.compareArray(case2get1, errors);
|
||||
assert.compareArray(case2get2, errors);
|
||||
|
||||
/////
|
||||
|
||||
errors = [undefined,,,,undefined];
|
||||
var case3 = new AggregateError(errors);
|
||||
var case3get1 = case3.errors;
|
||||
var case3get2 = case3.errors;
|
||||
|
||||
assert.sameValue(Array.isArray(case3get1), true);
|
||||
assert.sameValue(Array.isArray(case3get2), true);
|
||||
|
||||
assert.notSameValue(case3get1, errors, 'case3 - creates a new array #1');
|
||||
assert.notSameValue(case3get2, errors, 'case3 - creates a new array #2');
|
||||
assert.notSameValue(case3get1, case3get2, 'creates a new array everytime it gets the values');
|
||||
|
||||
assert.compareArray(case3get1, errors);
|
||||
assert.compareArray(case3get2, errors);
|
||||
|
||||
assert(Object.prototype.hasOwnProperty.call(case3get1, 0), 'filled array from a sparse origin - case3get1, 0');
|
||||
assert(Object.prototype.hasOwnProperty.call(case3get1, 1), 'filled array from a sparse origin - case3get1, 1');
|
||||
assert(Object.prototype.hasOwnProperty.call(case3get1, 2), 'filled array from a sparse origin - case3get1, 2');
|
||||
assert(Object.prototype.hasOwnProperty.call(case3get1, 3), 'filled array from a sparse origin - case3get1, 3');
|
||||
assert(Object.prototype.hasOwnProperty.call(case3get1, 4), 'filled array from a sparse origin - case3get1, 4');
|
||||
|
||||
assert(Object.prototype.hasOwnProperty.call(case3get2, 0), 'filled array from a sparse origin - case3get2, 0');
|
||||
assert(Object.prototype.hasOwnProperty.call(case3get2, 1), 'filled array from a sparse origin - case3get2, 1');
|
||||
assert(Object.prototype.hasOwnProperty.call(case3get2, 2), 'filled array from a sparse origin - case3get2, 2');
|
||||
assert(Object.prototype.hasOwnProperty.call(case3get2, 3), 'filled array from a sparse origin - case3get2, 3');
|
||||
assert(Object.prototype.hasOwnProperty.call(case3get2, 4), 'filled array from a sparse origin - case3get2, 4');
|
|
@ -1,29 +0,0 @@
|
|||
// Copyright (C) 2019 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-get-aggregate-error.prototype.errors
|
||||
description: >
|
||||
Throws a TypeError exception when `this` does not have a [[AggregateErrorData]]
|
||||
internal slot
|
||||
info: |
|
||||
get AggregateError.prototype.errors
|
||||
|
||||
1. Let E be the this value.
|
||||
2. If Type(E) is not Object, throw a TypeError exception.
|
||||
3. If E does not have an [[ErrorData]] internal slot, throw a TypeError exception.
|
||||
4. If E does not have an [[AggregateErrors]] internal slot, throw a TypeError exception.
|
||||
5. Return ! CreateArrayFromList(E.[[AggregateErrors]]).
|
||||
features: [AggregateError]
|
||||
---*/
|
||||
|
||||
var getter = Object.getOwnPropertyDescriptor(
|
||||
AggregateError.prototype, 'errors'
|
||||
).get;
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
getter.call(new Error());
|
||||
}, 'this is an instance of Error, no [[AggregateErrors]]');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
getter.call(AggregateError);
|
||||
}, 'AggregateError does not have an [[AggregateErrors]] internal');
|
|
@ -1,46 +0,0 @@
|
|||
// Copyright (C) 2019 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-get-aggregate-error.prototype.errors
|
||||
description: Throws a TypeError exception when `this` is not Object
|
||||
info: |
|
||||
get AggregateError.prototype.errors
|
||||
|
||||
1. Let E be the this value.
|
||||
2. If Type(E) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [AggregateError, Symbol]
|
||||
---*/
|
||||
|
||||
var getter = Object.getOwnPropertyDescriptor(
|
||||
AggregateError.prototype, 'errors'
|
||||
).get;
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
getter.call(undefined);
|
||||
}, 'this is undefined');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
getter.call(null);
|
||||
}, 'this is null');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
getter.call(42);
|
||||
}, 'this is 42');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
getter.call('1');
|
||||
}, 'this is a string');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
getter.call(true);
|
||||
}, 'this is true');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
getter.call(false);
|
||||
}, 'this is false');
|
||||
|
||||
var s = Symbol('s');
|
||||
assert.throws(TypeError, function() {
|
||||
getter.call(s);
|
||||
}, 'this is a Symbol');
|
Loading…
Reference in New Issue