| Index: test/webkit/fast/js/Promise-static-cast.js
|
| diff --git a/test/webkit/indexed-setter-on-global-object.js b/test/webkit/fast/js/Promise-static-cast.js
|
| similarity index 63%
|
| copy from test/webkit/indexed-setter-on-global-object.js
|
| copy to test/webkit/fast/js/Promise-static-cast.js
|
| index 20c70c24f5e5b8f887cc8ec8f1d4fbd99431c45d..48049398b069171b2876bff78be06999a507ab04 100644
|
| --- a/test/webkit/indexed-setter-on-global-object.js
|
| +++ b/test/webkit/fast/js/Promise-static-cast.js
|
| @@ -1,4 +1,4 @@
|
| -// Copyright 2013 the V8 project authors. All rights reserved.
|
| +// Copyright 2014 the V8 project authors. All rights reserved.
|
| // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
|
| //
|
| // Redistribution and use in source and binary forms, with or without
|
| @@ -21,16 +21,36 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -description(
|
| -"Tests that creating an indexed setter on the global object doesn't break things."
|
| -);
|
| +// Flags: --harmony
|
| +'use strict';
|
| +description('Test Promise.cast');
|
|
|
| -var thingy;
|
| +var result = undefined;
|
| +var result2 = undefined;
|
|
|
| -this.__defineSetter__(42, function(value) {
|
| - thingy = value;
|
| -});
|
| +var resolve;
|
| +var value = new Promise(function (r) { resolve = r;} );
|
| +var promise = Promise.cast(value);
|
| +
|
| +// If [[IsPromise]] is true, Promise.cast simply returns argument.
|
| +shouldBe('promise', 'value');
|
|
|
| -this[42] = "foo";
|
| +promise.then(function(res) {
|
| + result = res;
|
| + shouldBeEqualToString('result', 'hello');
|
| +
|
| + return Promise.cast(42).then(function (res) {
|
| + result2 = res;
|
| + shouldBe('result2', '42');
|
| + });
|
| +}).then(function () {
|
| + testPassed('fulfilled');
|
| + finishJSTest();
|
| +}, function() {
|
| + testFailed('rejected');
|
| + finishJSTest();
|
| +});
|
|
|
| -shouldBe("thingy", "\"foo\"");
|
| +resolve('hello');
|
| +shouldBe('result', 'undefined');
|
| +shouldBe('result2', 'undefined');
|
|
|