mirror of https://github.com/tc39/test262.git
37 lines
725 B
JavaScript
37 lines
725 B
JavaScript
|
// Copyright (C) 2021 Chengzhong Wu. All rights reserved.
|
||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||
|
|
||
|
/*---
|
||
|
description: Error constructor creates own properties in sequence
|
||
|
info: |
|
||
|
Error ( message [ , options ] )
|
||
|
|
||
|
...
|
||
|
4. Perform ? InstallErrorCause(O, options).
|
||
|
...
|
||
|
|
||
|
esid: sec-error-message
|
||
|
includes: [deepEqual.js]
|
||
|
---*/
|
||
|
|
||
|
var message = "my-message";
|
||
|
var cause = { message: "my-cause" };
|
||
|
|
||
|
var sequence = [];
|
||
|
new Error(
|
||
|
{
|
||
|
toString() {
|
||
|
sequence.push("toString");
|
||
|
return message;
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
get cause() {
|
||
|
sequence.push("cause");
|
||
|
return cause;
|
||
|
},
|
||
|
},
|
||
|
);
|
||
|
|
||
|
assert.deepEqual(sequence, [ "toString", "cause" ], "accessing own properties on sequence");
|