Implement other routines of Promise (#1729)
Add Promise.resolve, Promise.reject, Promise.race, Promise.all and Promise.prototype.catch Also it fixes the issue 1763 JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
This commit is contained in:
@@ -13,24 +13,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var a = new Promise(function(f, r){
|
||||
r(0);
|
||||
Promise.reject("abc").then(function(x)
|
||||
{
|
||||
assert (false); // should not run here.
|
||||
}, function(x)
|
||||
{
|
||||
assert (x === "abc");
|
||||
});
|
||||
|
||||
a
|
||||
.then(function f1(x) {
|
||||
return x + 1; // unreachable
|
||||
}, function r1(x){
|
||||
return x + 10;
|
||||
})
|
||||
.then(function f2(x) {
|
||||
throw x + 100
|
||||
})
|
||||
.then(function f3(x) {
|
||||
return x + 1000 //unreachable
|
||||
}, function r3(x) {
|
||||
return x + 10000
|
||||
})
|
||||
.then(function(x) {
|
||||
assert (x === 10110);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user