Index: test/cctest/test-extra.js |
diff --git a/test/cctest/test-extra.js b/test/cctest/test-extra.js |
index 88c5f6e659d7b5e44946c6d2ca11cc0c3f6997fe..69a7e63221545de7e85a12ccc13fbe12b93748b0 100644 |
--- a/test/cctest/test-extra.js |
+++ b/test/cctest/test-extra.js |
@@ -70,12 +70,30 @@ |
v8.rejectPromise(rejectedButHandledPromise, 4); |
v8.markPromiseAsHandled(rejectedButHandledPromise); |
+ function promiseStateToString(promise) { |
+ switch (v8.promiseState(promise)) { |
+ case v8.kPROMISE_PENDING: |
+ return "pending"; |
+ case v8.kPROMISE_FULFILLED: |
+ return "fulfilled"; |
+ case v8.kPROMISE_REJECTED: |
+ return "rejected"; |
+ default: |
+ throw new Error("Unexpected value for promiseState"); |
+ } |
+ } |
+ |
+ let promiseStates = promiseStateToString(new Promise(() => {})) + ' ' + |
+ promiseStateToString(fulfilledPromise) + ' ' + |
+ promiseStateToString(rejectedPromise); |
+ |
return { |
privateSymbol: v8.createPrivateSymbol('sym'), |
fulfilledPromise, // should be fulfilled with 1 |
fulfilledPromise2, // should be fulfilled with 2 |
rejectedPromise, // should be rejected with 3 |
- rejectedButHandledPromise // should be rejected but have a handler |
+ rejectedButHandledPromise, // should be rejected but have a handler |
+ promiseStates // should be the string "pending fulfilled rejected" |
}; |
}; |
}) |