summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Object/prototype/__proto__/set-non-object.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--js/src/tests/test262/built-ins/Object/prototype/__proto__/set-non-object.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Object/prototype/__proto__/set-non-object.js b/js/src/tests/test262/built-ins/Object/prototype/__proto__/set-non-object.js
new file mode 100644
index 0000000000..755540239f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/prototype/__proto__/set-non-object.js
@@ -0,0 +1,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 on a value that is object-coercible but not an Object
+info: |
+ 1. Let O be ? RequireObjectCoercible(this value).
+ 2. If Type(proto) is neither Object nor Null, return undefined.
+ 3. If Type(O) is not Object, return undefined.
+features: [Symbol, __proto__]
+---*/
+
+var set = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
+var subject = {};
+
+assert.sameValue(set.call(true), undefined, 'boolean');
+assert.sameValue(
+ Object.getPrototypeOf(subject), Object.prototype, 'following boolean'
+);
+
+assert.sameValue(set.call(1), undefined, 'number');
+assert.sameValue(
+ Object.getPrototypeOf(subject), Object.prototype, 'following number'
+);
+
+assert.sameValue(set.call('string'), undefined, 'string');
+assert.sameValue(
+ Object.getPrototypeOf(subject), Object.prototype, 'following string'
+);
+
+assert.sameValue(set.call(Symbol('')), undefined, 'symbol');
+assert.sameValue(
+ Object.getPrototypeOf(subject), Object.prototype, 'following symbol'
+);
+
+reportCompare(0, 0);