Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Unified Diff: test/webkit/fast/js/Promise-static-cast.js

Issue 196133017: Experimental parser: merge r19949 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/webkit/fast/js/Promise-static-cast.js
diff --git a/test/webkit/sort-with-side-effecting-comparisons.js b/test/webkit/fast/js/Promise-static-cast.js
similarity index 63%
copy from test/webkit/sort-with-side-effecting-comparisons.js
copy to test/webkit/fast/js/Promise-static-cast.js
index 6794e322f5df200658ec6f20bc367228e8874d49..48049398b069171b2876bff78be06999a507ab04 100644
--- a/test/webkit/sort-with-side-effecting-comparisons.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,22 +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(
-"Checks that sorting an array with a side-effecting comparison function doesn't trigger assertions."
-);
+// Flags: --harmony
+'use strict';
+description('Test Promise.cast');
-var array = [];
+var result = undefined;
+var result2 = undefined;
-for (var i = 0; i < 20000; ++i)
- array.push(i);
+var resolve;
+var value = new Promise(function (r) { resolve = r;} );
+var promise = Promise.cast(value);
-array.sort(function(a, b) {
- array.shift();
- if (a < b)
- return -1;
- if (a > b)
- return 1;
- return 0;
+// If [[IsPromise]] is true, Promise.cast simply returns argument.
+shouldBe('promise', 'value');
+
+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();
});
-testPassed("It worked.");
+resolve('hello');
+shouldBe('result', 'undefined');
+shouldBe('result2', 'undefined');
« no previous file with comments | « test/webkit/fast/js/Promise-static-all-expected.txt ('k') | test/webkit/fast/js/Promise-static-cast-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698