Remote tests for AggregateError.prototype.toString

Ref tc39/proposal-promise-any#49
This commit is contained in:
Leo Balter 2019-11-11 11:20:24 -05:00
parent 1bc193528b
commit 90231ad16f
21 changed files with 0 additions and 935 deletions

View File

@ -1,39 +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-aggregate-error.prototype.toString
description: >
Gets the Object message, returning abrupt completion
info: |
AggregateError.prototype.toString ( )
...
5. Let msg be ? Get(O, "message").
6. If msg is undefined, set msg to the empty String; otherwise set msg to ? ToString(msg).
7. If name is the empty String, return msg.
8. If msg is the empty String, return name.
9. Return the string-concatenation of name, the code unit 0x003A (COLON), the code unit 0x0020 (SPACE) and msg.
features: [AggregateError]
---*/
var method = AggregateError.prototype.toString;
var called = 0;
var nameCalled = 0;
var obj = {
get name() {
nameCalled += 1;
},
get message() {
called += 1;
throw new Test262Error();
}
};
assert.throws(Test262Error, () => {
method.call(obj);
});
assert.sameValue(called, 1);
assert.sameValue(nameCalled, 1);

View File

@ -1,54 +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-aggregate-error.prototype.toString
description: >
If message value is the empty string, return name
info: |
AggregateError.prototype.toString ( )
1. Let O be the this value.
2. If Type(O) is not Object, throw a TypeError exception.
3. Let name be ? Get(O, "name").
4. If name is undefined, set name to "AggregateError"; otherwise set name to ? ToString(name).
5. Let msg be ? Get(O, "message").
6. If msg is undefined, set msg to the empty String; otherwise set msg to ? ToString(msg).
7. If name is the empty String, return msg.
8. If msg is the empty String, return name.
9. Return the string-concatenation of name, the code unit 0x003A (COLON), the code unit 0x0020 (SPACE) and msg.
features: [AggregateError]
---*/
var method = AggregateError.prototype.toString;
var result = method.call({
name: 'the name',
message: '',
});
assert.sameValue(result, 'the name', 'explicit from own property');
result = false;
result = method.call(Object.create({
name: 'the name',
message: '',
}));
assert.sameValue(result, 'the name', 'explicit from prototype');
result = false;
result = method.call({
name: 'the name',
message: undefined,
});
assert.sameValue(result, 'the name', 'message is undefined');
result = false;
result = method.call({
name: 'the name!',
message: { toString() { return ''; } },
});
assert.sameValue(result, 'the name!', 'return name');

View File

@ -1,83 +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-aggregate-error.prototype.toString
description: >
ToString on the message object value
info: |
AggregateError.prototype.toString ( )
1. Let O be the this value.
2. If Type(O) is not Object, throw a TypeError exception.
3. Let name be ? Get(O, "name").
4. If name is undefined, set name to "AggregateError"; otherwise set name to ? ToString(name).
5. Let msg be ? Get(O, "message").
6. If msg is undefined, set msg to the empty String; otherwise set msg to ? ToString(msg).
7. If name is the empty String, return msg.
8. If msg is the empty String, return name.
9. Return the string-concatenation of name, the code unit 0x003A (COLON), the code unit 0x0020 (SPACE) and msg.
features: [AggregateError, Symbol.toPrimitive]
---*/
var method = AggregateError.prototype.toString;
var called = 0;
var obj = {
message: {
[Symbol.toPrimitive]() {
called += 1;
return 'from @@toPrimitive';
},
toString() {
throw new Test262Error();
},
valueOf() {
throw new Test262Error();
},
},
name: '',
};
var result = method.call(obj);
assert.sameValue(called, 1);
assert.sameValue(result, 'from @@toPrimitive');
called = 0;
obj = {
message: {
[Symbol.toPrimitive]: undefined,
toString() {
called += 1;
return 'from the toString method';
},
valueOf() {
throw new Test262Error();
},
},
name: '',
};
result = false;
result = method.call(obj);
assert.sameValue(called, 1);
assert.sameValue(result, 'from the toString method');
called = 0;
obj = {
message: {
[Symbol.toPrimitive]: undefined,
toString: undefined,
valueOf() {
called += 1;
return 'from the valueOf method';
},
},
name: '',
};
result = false;
result = method.call(obj);
assert.sameValue(called, 1);
assert.sameValue(result, 'from the valueOf method');

View File

@ -1,35 +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-aggregate-error.prototype.toString
description: >
ToString(Symbol msg)
info: |
AggregateError.prototype.toString ( )
1. Let O be the this value.
2. If Type(O) is not Object, throw a TypeError exception.
3. Let name be ? Get(O, "name").
4. If name is undefined, set name to "AggregateError"; otherwise set name to ? ToString(name).
5. Let msg be ? Get(O, "message").
6. If msg is undefined, set msg to the empty String; otherwise set msg to ? ToString(msg).
7. If name is the empty String, return msg.
8. If msg is the empty String, return name.
9. Return the string-concatenation of name, the code unit 0x003A (COLON), the code unit 0x0020 (SPACE) and msg.
features: [AggregateError, Symbol]
---*/
var method = AggregateError.prototype.toString;
var obj = { name: '', message: Symbol() };
assert.throws(TypeError, function() {
method.call(obj);
}, 'own property');
obj = Object.create({ name: '', message: Symbol() });
assert.throws(TypeError, function() {
method.call(obj);
}, 'from prototype');

View File

@ -1,38 +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-aggregate-error.prototype.toString
description: >
ToString(msg) where it can return "undefined"
info: |
AggregateError.prototype.toString ( )
1. Let O be the this value.
2. If Type(O) is not Object, throw a TypeError exception.
3. Let name be ? Get(O, "name").
4. If name is undefined, set name to "AggregateError"; otherwise set name to ? ToString(name).
5. Let msg be ? Get(O, "message").
6. If msg is undefined, set msg to the empty String; otherwise set msg to ? ToString(msg).
7. If name is the empty String, return msg.
8. If msg is the empty String, return name.
9. Return the string-concatenation of name, the code unit 0x003A (COLON), the code unit 0x0020 (SPACE) and msg.
features: [AggregateError]
---*/
var method = AggregateError.prototype.toString;
var obj = {
message: {
toString() {
return undefined;
}
},
name: 'hi',
};
assert.sameValue(method.call(obj), 'hi\u003A\u0020undefined', 'with name');
obj.name = '';
assert.sameValue(method.call(obj), 'undefined', 'without name');

View File

@ -1,36 +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-aggregate-error.prototype.toString
description: >
ToString(message)
info: |
AggregateError.prototype.toString ( )
1. Let O be the this value.
2. If Type(O) is not Object, throw a TypeError exception.
3. Let name be ? Get(O, "name").
4. If name is undefined, set name to "AggregateError"; otherwise set name to ? ToString(name).
5. Let msg be ? Get(O, "message").
6. If msg is undefined, set msg to the empty String; otherwise set msg to ? ToString(msg).
7. If name is the empty String, return msg.
8. If msg is the empty String, return name.
9. Return the string-concatenation of name, the code unit 0x003A (COLON), the code unit 0x0020 (SPACE) and msg.
features: [AggregateError]
---*/
var method = AggregateError.prototype.toString;
var obj = { name: '' };
obj.message = 0;
assert.sameValue(method.call(obj), '0', 'Number 0');
obj.message = null;
assert.sameValue(method.call(obj), 'null', 'null');
obj.message = false;
assert.sameValue(method.call(obj), 'false', 'false');
obj.message = true;
assert.sameValue(method.call(obj), 'true', 'true');
obj.message = 1;
assert.sameValue(method.call(obj), '1', 'Number 1');

View File

@ -1,64 +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-aggregate-error.prototype.toString
description: >
An undefined message property value is cast to 'AggregateError'
info: |
AggregateError.prototype.toString ( )
1. Let O be the this value.
2. If Type(O) is not Object, throw a TypeError exception.
3. Let name be ? Get(O, "name").
4. If name is undefined, set name to "AggregateError"; otherwise set name to ? ToString(name).
5. Let msg be ? Get(O, "message").
6. If msg is undefined, set msg to the empty String; otherwise set msg to ? ToString(msg).
7. If name is the empty String, return msg.
8. If msg is the empty String, return name.
9. Return the string-concatenation of name, the code unit 0x003A (COLON), the code unit 0x0020 (SPACE) and msg.
features: [AggregateError]
---*/
var method = AggregateError.prototype.toString;
var result = method.call({
message: undefined,
});
assert.sameValue(result, 'AggregateError', 'explicit from own property');
result = false;
result = method.call({});
assert.sameValue(result, 'AggregateError', 'implicit');
result = false;
result = method.call(Object.create({
message: undefined,
}));
assert.sameValue(result, 'AggregateError', 'explicit from prototype');
result = false;
result = method.call({
message: undefined,
name: 'a name',
});
assert.sameValue(result, 'a name', 'explicit from own property, name is set');
result = false;
result = method.call({
name: 'a name',
});
assert.sameValue(result, 'a name', 'implicit, name is set');
result = false;
result = method.call(Object.create({
message: undefined,
name: 'a name',
}));
assert.sameValue(result, 'a name', 'explicit from prototype, name is set');

View File

@ -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-aggregate-error.prototype.toString
description: >
Gets the Object message
info: |
AggregateError.prototype.toString ( )
...
5. Let msg be ? Get(O, "message").
...
features: [AggregateError]
---*/
var method = AggregateError.prototype.toString;
var called = 0;
var nameCalled = 0;
var obj = {
get name() {
nameCalled += 1;
},
get message() {
called += 1;
}
};
method.call(obj);
assert.sameValue(nameCalled, 1);
assert.sameValue(called, 1);

View File

@ -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-aggregate-error.prototype.toString
description: >
Gets the Object name, returning abrupt completion
info: |
AggregateError.prototype.toString ( )
1. Let O be the this value.
2. If Type(O) is not Object, throw a TypeError exception.
3. Let name be ? Get(O, "name").
4. If name is undefined, set name to "AggregateError"; otherwise set name to ? ToString(name).
...
features: [AggregateError]
---*/
var method = AggregateError.prototype.toString;
var called = 0;
var obj = {
get name() {
called += 1;
throw new Test262Error();
}
};
assert.throws(Test262Error, () => {
method.call(obj);
});
assert.sameValue(called, 1);

View File

@ -1,70 +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-aggregate-error.prototype.toString
description: >
If name value is the empty string, return msg
info: |
AggregateError.prototype.toString ( )
1. Let O be the this value.
2. If Type(O) is not Object, throw a TypeError exception.
3. Let name be ? Get(O, "name").
4. If name is undefined, set name to "AggregateError"; otherwise set name to ? ToString(name).
5. Let msg be ? Get(O, "message").
6. If msg is undefined, set msg to the empty String; otherwise set msg to ? ToString(msg).
7. If name is the empty String, return msg.
8. If msg is the empty String, return name.
9. Return the string-concatenation of name, the code unit 0x003A (COLON), the code unit 0x0020 (SPACE) and msg.
features: [AggregateError]
---*/
var method = AggregateError.prototype.toString;
var result = method.call({
name: '',
message: 'the message',
});
assert.sameValue(result, 'the message', 'explicit from own property');
result = false;
result = method.call(Object.create({
name: '',
message: 'the message',
}));
assert.sameValue(result, 'the message', 'explicit from prototype');
result = false;
result = method.call({
name: '',
message: '',
});
assert.sameValue(result, '', 'both name and msg are the empty string');
result = false;
result = method.call({
name: '',
message: undefined,
});
assert.sameValue(result, 'message', 'return msg');
result = false;
result = method.call({
name: { toString() { return ''; } },
message: 'the message!',
});
assert.sameValue(result, 'the message!', 'own name property is cast to an empty string');
result = false;
result = method.call(Object.create({
name: { toString() { return ''; } },
message: 'the message!',
}));
assert.sameValue(result, 'the message!', 'chained name property is cast to an empty string');

View File

@ -1,83 +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-aggregate-error.prototype.toString
description: >
ToString on the name object value
info: |
AggregateError.prototype.toString ( )
1. Let O be the this value.
2. If Type(O) is not Object, throw a TypeError exception.
3. Let name be ? Get(O, "name").
4. If name is undefined, set name to "AggregateError"; otherwise set name to ? ToString(name).
5. Let msg be ? Get(O, "message").
6. If msg is undefined, set msg to the empty String; otherwise set msg to ? ToString(msg).
7. If name is the empty String, return msg.
8. If msg is the empty String, return name.
9. Return the string-concatenation of name, the code unit 0x003A (COLON), the code unit 0x0020 (SPACE) and msg.
features: [AggregateError, Symbol.toPrimitive]
---*/
var method = AggregateError.prototype.toString;
var called = 0;
var obj = {
name: {
[Symbol.toPrimitive]() {
called += 1;
return 'from @@toPrimitive';
},
toString() {
throw new Test262Error();
},
valueOf() {
throw new Test262Error();
},
},
message: '',
};
var result = method.call(obj);
assert.sameValue(called, 1);
assert.sameValue(result, 'from @@toPrimitive');
called = 0;
obj = {
name: {
[Symbol.toPrimitive]: undefined,
toString() {
called += 1;
return 'from the toString method';
},
valueOf() {
throw new Test262Error();
},
},
message: '',
};
result = false;
result = method.call(obj);
assert.sameValue(called, 1);
assert.sameValue(result, 'from the toString method');
called = 0;
obj = {
name: {
[Symbol.toPrimitive]: undefined,
toString: undefined,
valueOf() {
called += 1;
return 'from the valueOf method';
},
},
message: '',
};
result = false;
result = method.call(obj);
assert.sameValue(called, 1);
assert.sameValue(result, 'from the valueOf method');

View File

@ -1,34 +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-aggregate-error.prototype.toString
description: >
ToString(name)
info: |
AggregateError.prototype.toString ( )
1. Let O be the this value.
2. If Type(O) is not Object, throw a TypeError exception.
3. Let name be ? Get(O, "name").
4. If name is undefined, set name to "AggregateError"; otherwise set name to ? ToString(name).
5. Let msg be ? Get(O, "message").
6. If msg is undefined, set msg to the empty String; otherwise set msg to ? ToString(msg).
7. If name is the empty String, return msg.
8. If msg is the empty String, return name.
9. Return the string-concatenation of name, the code unit 0x003A (COLON), the code unit 0x0020 (SPACE) and msg.
features: [AggregateError, Symbol]
---*/
var method = AggregateError.prototype.toString;
var obj = { name: Symbol(), message: '' };
assert.throws(TypeError, function() {
method.call(obj);
}, 'own property');
obj = Object.create({ name: Symbol(), message: '' });
assert.throws(TypeError, function() {
method.call(obj);
}, 'from prototype');

View File

@ -1,38 +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-aggregate-error.prototype.toString
description: >
ToString(name) where it can return "undefined"
info: |
AggregateError.prototype.toString ( )
1. Let O be the this value.
2. If Type(O) is not Object, throw a TypeError exception.
3. Let name be ? Get(O, "name").
4. If name is undefined, set name to "AggregateError"; otherwise set name to ? ToString(name).
5. Let msg be ? Get(O, "message").
6. If msg is undefined, set msg to the empty String; otherwise set msg to ? ToString(msg).
7. If name is the empty String, return msg.
8. If msg is the empty String, return name.
9. Return the string-concatenation of name, the code unit 0x003A (COLON), the code unit 0x0020 (SPACE) and msg.
features: [AggregateError]
---*/
var method = AggregateError.prototype.toString;
var obj = {
name: {
toString() {
return undefined;
}
},
message: '',
};
assert.sameValue(method.call(obj), 'undefined', 'without message');
obj.message = 'lol';
assert.sameValue(method.call(obj), 'undefined\u003A\u0020lol', 'with message');

View File

@ -1,36 +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-aggregate-error.prototype.toString
description: >
ToString(name)
info: |
AggregateError.prototype.toString ( )
1. Let O be the this value.
2. If Type(O) is not Object, throw a TypeError exception.
3. Let name be ? Get(O, "name").
4. If name is undefined, set name to "AggregateError"; otherwise set name to ? ToString(name).
5. Let msg be ? Get(O, "message").
6. If msg is undefined, set msg to the empty String; otherwise set msg to ? ToString(msg).
7. If name is the empty String, return msg.
8. If msg is the empty String, return name.
9. Return the string-concatenation of name, the code unit 0x003A (COLON), the code unit 0x0020 (SPACE) and msg.
features: [AggregateError]
---*/
var method = AggregateError.prototype.toString;
var obj = { message: '' };
obj.name = 0;
assert.sameValue(method.call(obj), '0', 'Number 0');
obj.name = null;
assert.sameValue(method.call(obj), 'null', 'null');
obj.name = false;
assert.sameValue(method.call(obj), 'false', 'false');
obj.name = true;
assert.sameValue(method.call(obj), 'true', 'true');
obj.name = 1;
assert.sameValue(method.call(obj), '1', 'Number 1');

View File

@ -1,68 +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-aggregate-error.prototype.toString
description: >
An undefined name property value is cast to 'AggregateError'
info: |
AggregateError.prototype.toString ( )
1. Let O be the this value.
2. If Type(O) is not Object, throw a TypeError exception.
3. Let name be ? Get(O, "name").
4. If name is undefined, set name to "AggregateError"; otherwise set name to ? ToString(name).
5. Let msg be ? Get(O, "message").
6. If msg is undefined, set msg to the empty String; otherwise set msg to ? ToString(msg).
7. If name is the empty String, return msg.
8. If msg is the empty String, return name.
9. Return the string-concatenation of name, the code unit 0x003A (COLON), the code unit 0x0020 (SPACE) and msg.
features: [AggregateError]
---*/
var method = AggregateError.prototype.toString;
var result = method.call({
name: undefined,
message: '',
});
assert.sameValue(result, 'AggregateError', 'explicit from own property');
result = false;
result = method.call({
message: '',
});
assert.sameValue(result, 'AggregateError', 'implicit');
result = false;
result = method.call(Object.create({
name: undefined,
message: '',
}));
assert.sameValue(result, 'AggregateError', 'explicit from prototype');
result = false;
result = method.call({
name: undefined,
message: 'a message',
});
assert.sameValue(result, 'AggregateError\u003A\u0020a message', 'explicit from own property, message is set');
result = false;
result = method.call({
message: 'a message',
});
assert.sameValue(result, 'AggregateError\u003A\u0020a message', 'implicit, message is set');
result = false;
result = method.call(Object.create({
name: undefined,
message: 'a message',
}));
assert.sameValue(result, 'AggregateError\u003A\u0020a message', 'explicit from prototype, message is set');

View File

@ -1,30 +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-aggregate-error.prototype.toString
description: >
Gets the Object name
info: |
AggregateError.prototype.toString ( )
1. Let O be the this value.
2. If Type(O) is not Object, throw a TypeError exception.
3. Let name be ? Get(O, "name").
4. If name is undefined, set name to "AggregateError"; otherwise set name to ? ToString(name).
...
features: [AggregateError]
---*/
var method = AggregateError.prototype.toString;
var called = 0;
var obj = {
get name() {
called += 1;
}
};
method.call(obj);
assert.sameValue(called, 1);

View File

@ -1,31 +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-aggregate-error.prototype.toString
description: >
Property descriptor of AggregateError.prototype.toString.length
info: |
AggregateError.prototype.toString
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]
---*/
verifyProperty(AggregateError.prototype.toString, 'length', {
value: 0,
enumerable: false,
writable: false,
configurable: true
});

View File

@ -1,24 +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-aggregate-error.prototype.toString
description: >
Property descriptor of AggregateError.prototype.toString.name
info: |
AggregateError.prototype.toString
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]
---*/
verifyProperty(AggregateError.prototype.toString, 'name', {
value: 'toString',
enumerable: false,
writable: false,
configurable: true
});

View File

@ -1,23 +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-aggregate-error.prototype.toString
description: >
Property descriptor of AggregateError.prototype.toString
info: |
ES Section 17
Every other data property (...) has the attributes { [[Writable]]: true, [[Enumerable]]: false,
[[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js]
features: [AggregateError]
---*/
assert.sameValue(typeof AggregateError.prototype.toString, 'function');
verifyProperty(AggregateError.prototype, 'toString', {
configurable: true,
writable: true,
enumerable: false,
});

View File

@ -1,38 +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-aggregate-error.prototype.toString
description: >
Returns a string concatenating name and msg when both are defined
info: |
AggregateError.prototype.toString ( )
1. Let O be the this value.
2. If Type(O) is not Object, throw a TypeError exception.
3. Let name be ? Get(O, "name").
4. If name is undefined, set name to "AggregateError"; otherwise set name to ? ToString(name).
5. Let msg be ? Get(O, "message").
6. If msg is undefined, set msg to the empty String; otherwise set msg to ? ToString(msg).
7. If name is the empty String, return msg.
8. If msg is the empty String, return name.
9. Return the string-concatenation of name, the code unit 0x003A (COLON), the code unit 0x0020 (SPACE) and msg.
features: [AggregateError]
---*/
var method = AggregateError.prototype.toString;
var obj = {
name: 'foo',
message: 'bar',
};
assert.sameValue(method.call(obj), 'foo\u003A\u0020bar');
obj = new AggregateError(['a', 'b', 'c'], 'Hello World!');
assert.sameValue(method.call(obj), 'AggregateError\u003A\u0020Hello World!');
obj = new AggregateError(['a', 'b', 'c']);
assert.sameValue(method.call(obj), 'AggregateError');

View File

@ -1,45 +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-aggregate-error.prototype.toString
description: >
Property descriptor of AggregateError.prototype.toString
info: |
AggregateError.prototype.toString ( )
1. Let O be the this value.
2. If Type(O) is not Object, throw a TypeError exception.
features: [AggregateError, Symbol]
---*/
var method = AggregateError.prototype.toString;
assert.throws(TypeError, () => {
method.call(undefined);
}, 'undefined');
assert.throws(TypeError, () => {
method.call(null);
}, 'null');
assert.throws(TypeError, () => {
method.call(false);
}, 'false');
assert.throws(TypeError, () => {
method.call(true);
}, 'true');
assert.throws(TypeError, () => {
method.call(42);
}, 'number');
assert.throws(TypeError, () => {
method.call('string');
}, 'string');
var s = Symbol();
assert.throws(TypeError, () => {
method.call(s);
}, 'symbol');