Index: test/webkit/fast/js/Promise-resolve-with-then-fulfill.js |
diff --git a/test/webkit/dfg-intrinsic-osr-exit.js b/test/webkit/fast/js/Promise-resolve-with-then-fulfill.js |
similarity index 69% |
copy from test/webkit/dfg-intrinsic-osr-exit.js |
copy to test/webkit/fast/js/Promise-resolve-with-then-fulfill.js |
index 4ac756c310f3de11b37ef554399c35a764af8cd9..b627286b5b3f893e18715b62d71280dab2f8968b 100644 |
--- a/test/webkit/dfg-intrinsic-osr-exit.js |
+++ b/test/webkit/fast/js/Promise-resolve-with-then-fulfill.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,20 +21,31 @@ |
// (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( |
-"This tests that an OSR exit inside of an intrinsic that was not loaded with a method check works correctly." |
-); |
+// Flags: --harmony |
+'use strict'; |
+description('Test whether Promise treats thenable correctly.'); |
-function foo(a,b) { |
- return a[0](b.f); |
-} |
+var thisValue; |
+var result; |
+var value = { |
+ then: function(onFulfilled) { |
+ testPassed('value.then is called.'); |
+ thisValue = this; |
+ shouldBe('thisValue', 'value'); |
+ onFulfilled('hello'); |
+ } |
+}; |
-for (var i = 0; i < 100; ++i) |
- foo([Math.abs], {f:5}); |
+new Promise(function(resolve) { |
+ resolve(value); |
+}).then(function(localResult) { |
+ testPassed('fulfilled'); |
+ result = localResult; |
+ shouldBeEqualToString('result', 'hello'); |
+ finishJSTest(); |
+}, function() { |
+ testFailed('rejected'); |
+ finishJSTest(); |
+}); |
-shouldBe("foo([Math.abs], {f:5})", "5"); |
- |
-for (var i = 0; i < 10; ++i) |
- shouldBe("foo([Math.abs], {f:5.5})", "5.5"); |
- |
-var successfullyParsed = true; |
+debug('The promise is not fulfilled now.'); |