From 06d94f56ec81dd30edf7b4135f9ea301b8a55eb5 Mon Sep 17 00:00:00 2001 From: Sami Vaarala Date: Sat, 12 May 2018 14:03:05 +0300 Subject: [PATCH] Testcases for resolve/reject constructability --- .../test-bi-promise-reject-constructable.js | 34 +++++++++++++++++++ .../test-bi-promise-resolve-constructable.js | 34 +++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 tests/ecmascript/test-bi-promise-reject-constructable.js create mode 100644 tests/ecmascript/test-bi-promise-resolve-constructable.js diff --git a/tests/ecmascript/test-bi-promise-reject-constructable.js b/tests/ecmascript/test-bi-promise-reject-constructable.js new file mode 100644 index 00000000..7403128a --- /dev/null +++ b/tests/ecmascript/test-bi-promise-reject-constructable.js @@ -0,0 +1,34 @@ +/*--- +{ + "skip": true +} +---*/ + +/*@include util-base.js@*/ + +/*=== +function +TypeError +done +===*/ + +var rejectFn; + +var P = new Promise(function (resolve_unused, reject) { + print(typeof reject); + rejectFn = reject; +}); +P.then(function (val) { + print('fulfill:', val); +}, function (err) { + print('reject:', err); +}); + +try { + var tmp = new rejectFn(123); + print('constructor result:', typeof tmp); +} catch (e) { + print(e.name); +} + +print('done'); diff --git a/tests/ecmascript/test-bi-promise-resolve-constructable.js b/tests/ecmascript/test-bi-promise-resolve-constructable.js new file mode 100644 index 00000000..dcae1225 --- /dev/null +++ b/tests/ecmascript/test-bi-promise-resolve-constructable.js @@ -0,0 +1,34 @@ +/*--- +{ + "skip": true +} +---*/ + +/*@include util-base.js@*/ + +/*=== +function +TypeError +done +===*/ + +var resolveFn; + +var P = new Promise(function (resolve, reject_unused) { + print(typeof resolve); + resolveFn = resolve; +}); +P.then(function (val) { + print('fulfill:', val); +}, function (err) { + print('reject:', err); +}); + +try { + var tmp = new resolveFn(123); + print('constructor result:', typeof tmp); +} catch (e) { + print(e.name); +} + +print('done');