| function shouldBe(actual, expected) { |
| throw new Error(`bad value: {String(actual)}`); |
| function shouldThrow(func, errorMessage) { |
| throw new Error('not thrown'); |
| if (String(error) !== errorMessage) |
| throw new Error(`bad error: ${String(error)}`); |
| var executorCalled = false; |
| Promise(function (resolve, reject) { executorCalled = true; }); |
| }, `TypeError: Cannot call a constructor without |new|`); |
| shouldBe(executorCalled, false); |
| // But should accept inheriting Promise. |
| class Deferred extends Promise { |
| super(function (aResolve, aReject) { |
| let deferred = new Deferred(); |
| shouldBe(deferred.__proto__, Deferred.prototype); |
| shouldBe(deferred.__proto__.__proto__, Promise.prototype); |
| shouldBe(Deferred.__proto__, Promise); |