keith_miller@apple.com | bcc77f2 | 2016-07-15 06:03:25 +0000 | [diff] [blame] | 1 | // Copyright (C) 2015 the V8 project authors. All rights reserved. |
| 2 | // This code is governed by the BSD license found in the LICENSE file. |
| 3 | |
| 4 | /*--- |
| 5 | description: > |
| 6 | `Promise.resolve` invoked on a non-object value |
| 7 | es6id: 25.4.4.5 |
| 8 | info: > |
| 9 | 1. Let C be the this value. |
| 10 | 2. If Type(C) is not Object, throw a TypeError exception. |
| 11 | features: [Symbol] |
| 12 | ---*/ |
| 13 | |
| 14 | assert.throws(TypeError, function() { |
| 15 | Promise.resolve.call(undefined, []); |
| 16 | }); |
| 17 | |
| 18 | assert.throws(TypeError, function() { |
| 19 | Promise.resolve.call(null, []); |
| 20 | }); |
| 21 | |
| 22 | assert.throws(TypeError, function() { |
| 23 | Promise.resolve.call(86, []); |
| 24 | }); |
| 25 | |
| 26 | assert.throws(TypeError, function() { |
| 27 | Promise.resolve.call('string', []); |
| 28 | }); |
| 29 | |
| 30 | assert.throws(TypeError, function() { |
| 31 | Promise.resolve.call(true, []); |
| 32 | }); |
| 33 | |
| 34 | assert.throws(TypeError, function() { |
| 35 | Promise.resolve.call(Symbol(), []); |
| 36 | }); |