mirror of https://github.com/tc39/test262.git
Remove remaining cases for ...{
This commit is contained in:
parent
75db6744eb
commit
ceaa012121
|
@ -1,36 +0,0 @@
|
||||||
// Copyright (C) 2017 Caio Lima. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
desc: >
|
|
||||||
When DestructuringAssignmentTarget is an object literal, it should be parsed
|
|
||||||
parsed as a DestructuringAssignmentPattern and evaluated as a destructuring
|
|
||||||
assignment and object rest desconstruction is allowed in that case.
|
|
||||||
template: default
|
|
||||||
esid: pending
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [object-rest]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
//- setup
|
|
||||||
var a, b, c, rest;
|
|
||||||
//- elems
|
|
||||||
{a, b, ...{c, ...rest}}
|
|
||||||
//- vals
|
|
||||||
{a: 1, b: 2, c: 3, d: 4, e: 5}
|
|
||||||
//- body
|
|
||||||
assert.sameValue(a, 1);
|
|
||||||
assert.sameValue(b, 2);
|
|
||||||
assert.sameValue(c, 3);
|
|
||||||
|
|
||||||
assert.sameValue(rest.d, 4);
|
|
||||||
assert.sameValue(rest.e, 5);
|
|
||||||
|
|
||||||
verifyEnumerable(rest, "d");
|
|
||||||
verifyWritable(rest, "d");
|
|
||||||
verifyConfigurable(rest, "d");
|
|
||||||
|
|
||||||
verifyEnumerable(rest, "e");
|
|
||||||
verifyWritable(rest, "e");
|
|
||||||
verifyConfigurable(rest, "e");
|
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
// Copyright (C) 2017 Caio Lima. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
desc: >
|
|
||||||
When DestructuringAssignmentTarget is an object literal, it should be parsed
|
|
||||||
parsed as a DestructuringAssignmentPattern and evaluated as a destructuring
|
|
||||||
assignment.
|
|
||||||
template: default
|
|
||||||
esid: pending
|
|
||||||
features: [object-rest]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
//- setup
|
|
||||||
var a, b, c, d, e;
|
|
||||||
//- elems
|
|
||||||
{a, b, ...{c, e}}
|
|
||||||
//- vals
|
|
||||||
{a: 1, b: 2, c: 3, d: 4, e: 5}
|
|
||||||
//- body
|
|
||||||
assert.sameValue(a, 1);
|
|
||||||
assert.sameValue(b, 2);
|
|
||||||
assert.sameValue(c, 3);
|
|
||||||
assert.sameValue(e, 5);
|
|
||||||
assert.sameValue(d, undefined);
|
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
// Copyright (C) 2017 Caio Lima. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
desc: >
|
|
||||||
Rest object contains just source object's own properties
|
|
||||||
template: default
|
|
||||||
esid: pending
|
|
||||||
features: [object-rest]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
//- setup
|
|
||||||
var o = Object.create({ x: 1, y: 2 });
|
|
||||||
o.z = 3;
|
|
||||||
|
|
||||||
var x, y, z;
|
|
||||||
//- elems
|
|
||||||
{ x, ...{y , z} }
|
|
||||||
//- vals
|
|
||||||
o
|
|
||||||
//- body
|
|
||||||
assert.sameValue(x, 1);
|
|
||||||
assert.sameValue(y, undefined);
|
|
||||||
assert.sameValue(z, 3);
|
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
// Copyright (C) 2017 Caio Lima. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
desc: >
|
|
||||||
When DestructuringAssignmentTarget is an object literal, it should be parsed
|
|
||||||
parsed as a DestructuringAssignmentPattern and evaluated as a destructuring
|
|
||||||
assignment.
|
|
||||||
template: default
|
|
||||||
esid: pending
|
|
||||||
features: [object-rest]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
//- setup
|
|
||||||
var obj = {a: 3, b: 4};
|
|
||||||
//- elems
|
|
||||||
{a, b, ...{c, e}}
|
|
||||||
//- vals
|
|
||||||
{a: 1, b: 2, c: 3, d: 4, e: 5}
|
|
||||||
//- body
|
|
||||||
assert.sameValue(a, 1);
|
|
||||||
assert.sameValue(b, 2);
|
|
||||||
assert.sameValue(c, 3);
|
|
||||||
assert.sameValue(e, 5);
|
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
// Copyright (C) 2017 Caio Lima. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
desc: >
|
|
||||||
When DestructuringAssignmentTarget is an object literal, it should be parsed
|
|
||||||
parsed as a DestructuringAssignmentPattern and evaluated as a destructuring
|
|
||||||
assignment and object rest desconstruction is allowed in that case.
|
|
||||||
template: default
|
|
||||||
esid: pending
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [object-rest]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
//- elems
|
|
||||||
{a, b, ...{c, ...rest}}
|
|
||||||
//- vals
|
|
||||||
{a: 1, b: 2, c: 3, d: 4, e: 5}
|
|
||||||
//- body
|
|
||||||
assert.sameValue(a, 1);
|
|
||||||
assert.sameValue(b, 2);
|
|
||||||
assert.sameValue(c, 3);
|
|
||||||
|
|
||||||
assert.sameValue(rest.d, 4);
|
|
||||||
assert.sameValue(rest.e, 5);
|
|
||||||
|
|
||||||
verifyEnumerable(rest, "d");
|
|
||||||
verifyWritable(rest, "d");
|
|
||||||
verifyConfigurable(rest, "d");
|
|
||||||
|
|
||||||
verifyEnumerable(rest, "e");
|
|
||||||
verifyWritable(rest, "e");
|
|
||||||
verifyConfigurable(rest, "e");
|
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
// Copyright (C) 2017 Caio Lima. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
desc: >
|
|
||||||
Rest object contains just soruce object's own properties
|
|
||||||
template: default
|
|
||||||
esid: pending
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [object-rest]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
//- setup
|
|
||||||
var o = Object.create({ x: 1, y: 2 });
|
|
||||||
o.z = 3;
|
|
||||||
//- elems
|
|
||||||
{ x, ...{y , z} }
|
|
||||||
//- vals
|
|
||||||
o
|
|
||||||
//- body
|
|
||||||
assert.sameValue(x, 1);
|
|
||||||
assert.sameValue(y, undefined);
|
|
||||||
assert.sameValue(z, 3);
|
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
// Copyright (C) 2017 Caio Lima. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
desc: Object Spread operator results in error when there is an getter that throws an exception
|
|
||||||
template: error
|
|
||||||
esid: pending
|
|
||||||
info: |
|
|
||||||
Pending Runtime Semantics: PropertyDefinitionEvaluation
|
|
||||||
|
|
||||||
PropertyDefinition:...AssignmentExpression
|
|
||||||
|
|
||||||
1. Let exprValue be the result of evaluating AssignmentExpression.
|
|
||||||
2. Let fromValue be GetValue(exprValue).
|
|
||||||
3. ReturnIfAbrupt(fromValue).
|
|
||||||
4. Let excludedNames be a new empty List.
|
|
||||||
5. Return CopyDataProperties(object, fromValue, excludedNames).
|
|
||||||
features: [object-spread]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
//- error
|
|
||||||
Test262Error
|
|
||||||
//- args
|
|
||||||
{a: 1, ...{ get foo() { throw new Test262Error(); } }}
|
|
|
@ -1,39 +0,0 @@
|
||||||
// Copyright (C) 2017 Caio Lima. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
desc: Object Spread operator following other arguments
|
|
||||||
template: default
|
|
||||||
esid: pending
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
info: |
|
|
||||||
Pending Runtime Semantics: PropertyDefinitionEvaluation
|
|
||||||
|
|
||||||
PropertyDefinition:...AssignmentExpression
|
|
||||||
|
|
||||||
1. Let exprValue be the result of evaluating AssignmentExpression.
|
|
||||||
2. Let fromValue be GetValue(exprValue).
|
|
||||||
3. ReturnIfAbrupt(fromValue).
|
|
||||||
4. Let excludedNames be a new empty List.
|
|
||||||
5. Return CopyDataProperties(object, fromValue, excludedNames).
|
|
||||||
features: [object-spread]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
//- args
|
|
||||||
{a: 1, b: 2, ...{c: 3, d: 4}}
|
|
||||||
//- params
|
|
||||||
obj
|
|
||||||
//- body
|
|
||||||
assert.sameValue(obj.a, 1);
|
|
||||||
assert.sameValue(obj.b, 2);
|
|
||||||
assert.sameValue(obj.c, 3);
|
|
||||||
assert.sameValue(obj.d, 4);
|
|
||||||
assert.sameValue(Object.keys(obj).length, 4);
|
|
||||||
|
|
||||||
verifyEnumerable(obj, "c");
|
|
||||||
verifyWritable(obj, "c");
|
|
||||||
verifyConfigurable(obj, "c");
|
|
||||||
|
|
||||||
verifyEnumerable(obj, "d");
|
|
||||||
verifyWritable(obj, "d");
|
|
||||||
verifyConfigurable(obj, "d");
|
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
// Copyright (C) 2017 Caio Lima. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
desc: Object Spread operator following other arguments with empty object
|
|
||||||
template: default
|
|
||||||
esid: pending
|
|
||||||
info: |
|
|
||||||
Pending Runtime Semantics: PropertyDefinitionEvaluation
|
|
||||||
|
|
||||||
PropertyDefinition:...AssignmentExpression
|
|
||||||
|
|
||||||
1. Let exprValue be the result of evaluating AssignmentExpression.
|
|
||||||
2. Let fromValue be GetValue(exprValue).
|
|
||||||
3. ReturnIfAbrupt(fromValue).
|
|
||||||
4. Let excludedNames be a new empty List.
|
|
||||||
5. Return CopyDataProperties(object, fromValue, excludedNames).
|
|
||||||
features: [object-spread]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
//- args
|
|
||||||
{a: 1, b: 2, ...{}}
|
|
||||||
//- params
|
|
||||||
obj
|
|
||||||
//- body
|
|
||||||
assert.sameValue(obj.a, 1);
|
|
||||||
assert.sameValue(obj.b, 2);
|
|
||||||
assert.sameValue(Object.keys(obj).length, 2);
|
|
|
@ -1,30 +0,0 @@
|
||||||
// Copyright (C) 2017 Caio Lima. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
desc: Object Spread operator following other arguments with null, undefined and empty object
|
|
||||||
template: default
|
|
||||||
esid: pending
|
|
||||||
includes: [compareArray.js]
|
|
||||||
info: |
|
|
||||||
Pending Runtime Semantics: PropertyDefinitionEvaluation
|
|
||||||
|
|
||||||
PropertyDefinition:...AssignmentExpression
|
|
||||||
|
|
||||||
1. Let exprValue be the result of evaluating AssignmentExpression.
|
|
||||||
2. Let fromValue be GetValue(exprValue).
|
|
||||||
3. ReturnIfAbrupt(fromValue).
|
|
||||||
4. Let excludedNames be a new empty List.
|
|
||||||
5. Return CopyDataProperties(object, fromValue, excludedNames).
|
|
||||||
features: [object-spread]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
//- args
|
|
||||||
{a: 1, ...null, b: 2, ...undefined, c: 3, ...{}, ...{...{}}, d: 4}
|
|
||||||
//- params
|
|
||||||
obj
|
|
||||||
//- body
|
|
||||||
assert.sameValue(obj.a, 1);
|
|
||||||
assert.sameValue(obj.b, 2);
|
|
||||||
assert.sameValue(obj.c, 3);
|
|
||||||
assert.sameValue(obj.d, 4);
|
|
||||||
assert(compareArray(Object.keys(obj), ["a", "b", "c", "d"]));
|
|
|
@ -1,20 +0,0 @@
|
||||||
// Copyright (C) 2017 Caio Lima. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
desc: Setter are not executed when redefined in Object Spread
|
|
||||||
template: default
|
|
||||||
esid: pending
|
|
||||||
features: [object-spread]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
//- setup
|
|
||||||
let executedSetter = false;
|
|
||||||
|
|
||||||
//- args
|
|
||||||
{set c(v) { executedSetter = true; }, ...{c: 1}}
|
|
||||||
//- params
|
|
||||||
obj
|
|
||||||
//- body
|
|
||||||
assert.sameValue(obj.c, 1);
|
|
||||||
assert.sameValue(executedSetter, false);
|
|
||||||
assert.sameValue(Object.keys(obj).length, 1);
|
|
|
@ -1,24 +0,0 @@
|
||||||
// Copyright (C) 2017 Caio Lima. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
desc: Object Spread operator results in error when there is an getter that throws an exception
|
|
||||||
template: error
|
|
||||||
esid: pending
|
|
||||||
info: |
|
|
||||||
Pending Runtime Semantics: PropertyDefinitionEvaluation
|
|
||||||
|
|
||||||
PropertyDefinition:...AssignmentExpression
|
|
||||||
|
|
||||||
1. Let exprValue be the result of evaluating AssignmentExpression.
|
|
||||||
2. Let fromValue be GetValue(exprValue).
|
|
||||||
3. ReturnIfAbrupt(fromValue).
|
|
||||||
4. Let excludedNames be a new empty List.
|
|
||||||
5. Return CopyDataProperties(object, fromValue, excludedNames).
|
|
||||||
|
|
||||||
features: [object-spread]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
//- error
|
|
||||||
Test262Error
|
|
||||||
//- args
|
|
||||||
{...{ get foo() { throw new Test262Error(); } }}
|
|
|
@ -1,36 +0,0 @@
|
||||||
// Copyright (C) 2017 Caio Lima. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
desc: Object Spread operator without other arguments
|
|
||||||
template: default
|
|
||||||
esid: pending
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
info: |
|
|
||||||
Pending Runtime Semantics: PropertyDefinitionEvaluation
|
|
||||||
|
|
||||||
PropertyDefinition:...AssignmentExpression
|
|
||||||
|
|
||||||
1. Let exprValue be the result of evaluating AssignmentExpression.
|
|
||||||
2. Let fromValue be GetValue(exprValue).
|
|
||||||
3. ReturnIfAbrupt(fromValue).
|
|
||||||
4. Let excludedNames be a new empty List.
|
|
||||||
5. Return CopyDataProperties(object, fromValue, excludedNames).
|
|
||||||
features: [object-spread]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
//- args
|
|
||||||
{...{c: 3, d: 4}}
|
|
||||||
//- params
|
|
||||||
obj
|
|
||||||
//- body
|
|
||||||
assert.sameValue(obj.c, 3);
|
|
||||||
assert.sameValue(obj.d, 4);
|
|
||||||
assert.sameValue(Object.keys(obj).length, 2);
|
|
||||||
|
|
||||||
verifyEnumerable(obj, "c");
|
|
||||||
verifyWritable(obj, "c");
|
|
||||||
verifyConfigurable(obj, "c");
|
|
||||||
|
|
||||||
verifyEnumerable(obj, "d");
|
|
||||||
verifyWritable(obj, "d");
|
|
||||||
verifyConfigurable(obj, "d");
|
|
|
@ -1,25 +0,0 @@
|
||||||
// Copyright (C) 2017 Caio Lima. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
desc: Object Spread operator on a single empty object
|
|
||||||
template: default
|
|
||||||
esid: pending
|
|
||||||
info: |
|
|
||||||
Pending Runtime Semantics: PropertyDefinitionEvaluation
|
|
||||||
|
|
||||||
PropertyDefinition:...AssignmentExpression
|
|
||||||
|
|
||||||
1. Let exprValue be the result of evaluating AssignmentExpression.
|
|
||||||
2. Let fromValue be GetValue(exprValue).
|
|
||||||
3. ReturnIfAbrupt(fromValue).
|
|
||||||
4. Let excludedNames be a new empty List.
|
|
||||||
5. Return CopyDataProperties(object, fromValue, excludedNames).
|
|
||||||
features: [object-spread]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
//- args
|
|
||||||
{...{}}
|
|
||||||
//- params
|
|
||||||
obj
|
|
||||||
//- body
|
|
||||||
assert.sameValue(Object.keys(obj).length, 0);
|
|
Loading…
Reference in New Issue