blob: 6d8e70c14dd7fc457cb04db88812630f89fc0517 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 19.1.2.18
description: Object.setPrototypeOf invoked with an invalid prototype value
info: |
1. Let O be RequireObjectCoercible(O).
2. ReturnIfAbrupt(O).
3. If Type(proto) is neither Object nor Null, throw a TypeError exception.
features: [Symbol]
---*/
assert.throws(TypeError, function() {
Object.setPrototypeOf({});
});
assert.throws(TypeError, function() {
Object.setPrototypeOf({}, undefined);
});
assert.throws(TypeError, function() {
Object.setPrototypeOf({}, true);
});
assert.throws(TypeError, function() {
Object.setPrototypeOf({}, 1);
});
assert.throws(TypeError, function() {
Object.setPrototypeOf({}, 'string');
});
assert.throws(TypeError, function() {
Object.setPrototypeOf({}, Symbol('s'));
});
reportCompare(0, 0);
|