| function shouldBe(actual, expected) { |
| throw new Error('bad value: ' + actual); |
| function shouldThrow(func, errorMessage) { |
| throw new Error('not thrown'); |
| if (String(error) !== errorMessage) |
| throw new Error(`bad error: ${String(error)}`); |
| var object = Object.preventExtensions(Object.create(proto)); |
| shouldBe(Object.setPrototypeOf(object, proto), object); |
| Object.setPrototypeOf(object, {}); |
| }, `TypeError: Attempted to assign to readonly property.`); |
| shouldBe(Reflect.getPrototypeOf(object), proto); |
| shouldBe(Reflect.setPrototypeOf(object, proto), true); |
| shouldBe(Reflect.setPrototypeOf(object, {}), false); |
| shouldBe(Reflect.getPrototypeOf(object), proto); |
| object.__proto__ = proto; |
| }, `TypeError: Attempted to assign to readonly property.`); |
| shouldBe(object.__proto__, proto); |