diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Promise/prototype/then/rxn-handler-fulfilled-invoke-strict-strict.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Promise/prototype/then/rxn-handler-fulfilled-invoke-strict-strict.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Promise/prototype/then/rxn-handler-fulfilled-invoke-strict-strict.js b/js/src/tests/test262/built-ins/Promise/prototype/then/rxn-handler-fulfilled-invoke-strict-strict.js new file mode 100644 index 0000000000..3c0ab9a54d --- /dev/null +++ b/js/src/tests/test262/built-ins/Promise/prototype/then/rxn-handler-fulfilled-invoke-strict-strict.js @@ -0,0 +1,39 @@ +// |reftest| async +'use strict'; +// Copyright 2014 Cubane Canada, Inc. All rights reserved. +// See LICENSE for details. + +/*--- +info: | + [...] + 6. Else, let handlerResult be Call(handler, undefined, «argument»). +es6id: S25.4.2.1_A3.1_T2 +author: Sam Mikes +description: > + "fulfilled" handler invoked correctly in strict mode +flags: [async, onlyStrict] +---*/ + +var expectedThis = undefined, + obj = {}; + +var p = Promise.resolve(obj).then(function(arg) { + if (this !== expectedThis) { + $DONE("'this' must be undefined, got " + this); + return; + } + + if (arg !== obj) { + $DONE("Expected promise to be fulfilled by obj, actually " + arg); + return; + } + + if (arguments.length !== 1) { + $DONE('Expected handler function to be called with exactly 1 argument.'); + return; + } + + $DONE(); +}, function() { + $DONE('The promise should not be rejected.'); +}); |