summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Object/setPrototypeOf/proto-not-obj.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Object/setPrototypeOf/proto-not-obj.js')
-rw-r--r--js/src/tests/test262/built-ins/Object/setPrototypeOf/proto-not-obj.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Object/setPrototypeOf/proto-not-obj.js b/js/src/tests/test262/built-ins/Object/setPrototypeOf/proto-not-obj.js
new file mode 100644
index 0000000000..6d8e70c14d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/setPrototypeOf/proto-not-obj.js
@@ -0,0 +1,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);