summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Object/prototype/__proto__/set-invalid-value.js
blob: 0459a9f25faa08974e337f3aa13f8380e951ef50 (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) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-object.prototype.__proto__
es6id: B.2.2.1
description: Called with a value that is neither an Object nor Null
info: |
    1. Let O be ? RequireObjectCoercible(this value).
    2. If Type(proto) is neither Object nor Null, return undefined.
features: [Symbol, __proto__]
---*/

var set = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
var subject = {};

assert.sameValue(set.call(subject, true), undefined, 'boolean');
assert.sameValue(
  Object.getPrototypeOf(subject), Object.prototype, 'following boolean'
);

assert.sameValue(set.call(subject, 1), undefined, 'number');
assert.sameValue(
  Object.getPrototypeOf(subject), Object.prototype, 'following number'
);

assert.sameValue(set.call(subject, 'string'), undefined, 'string');
assert.sameValue(
  Object.getPrototypeOf(subject), Object.prototype, 'following string'
);

assert.sameValue(set.call(subject, Symbol('')), undefined, 'symbol');
assert.sameValue(
  Object.getPrototypeOf(subject), Object.prototype, 'following symbol'
);


reportCompare(0, 0);