From 8ce27898b919755ad46c1c82a2dca59c2ab3c0bd Mon Sep 17 00:00:00 2001 From: Alexey Shvayka Date: Wed, 15 Jan 2020 17:48:22 +0200 Subject: [PATCH] Add Then Finally Functions test --- ...resolved-observable-then-calls-argument.js | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test/built-ins/Promise/prototype/finally/resolved-observable-then-calls-argument.js diff --git a/test/built-ins/Promise/prototype/finally/resolved-observable-then-calls-argument.js b/test/built-ins/Promise/prototype/finally/resolved-observable-then-calls-argument.js new file mode 100644 index 0000000000..64ee539c4a --- /dev/null +++ b/test/built-ins/Promise/prototype/finally/resolved-observable-then-calls-argument.js @@ -0,0 +1,30 @@ +// Copyright (C) 2019 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-thenfinallyfunctions +description: > + valueThunk is anonymous built-in function with length of 1 that returns value. +info: | + Then Finally Functions + + ... + 8. Let valueThunk be equivalent to a function that returns value. + 9. Return ? Invoke(promise, "then", « valueThunk »). + + The "length" property of a Then Finally function is 1. +features: [Promise.prototype.finally, Reflect.construct] +includes: [isConstructor.js] +flags: [async] +---*/ + +var value = {}; + +Promise.resolve(value).finally(function() {}); +Promise.prototype.then = function(valueThunk) { + assert(!isConstructor(valueThunk)); + assert.sameValue(valueThunk.length, 1); + assert.sameValue(valueThunk.name, ''); + assert.sameValue(valueThunk(), value); + + $DONE(); +};