| Index: test/webkit/fast/js/Promise-resolve-with-itself.js
|
| diff --git a/test/webkit/array-sort-numericCompare.js b/test/webkit/fast/js/Promise-resolve-with-itself.js
|
| similarity index 71%
|
| copy from test/webkit/array-sort-numericCompare.js
|
| copy to test/webkit/fast/js/Promise-resolve-with-itself.js
|
| index 74df82f61db4568b7791bc82188dddaba70e84f1..22d05cd2922971c96f53d503b33d8738edaaf29c 100644
|
| --- a/test/webkit/array-sort-numericCompare.js
|
| +++ b/test/webkit/fast/js/Promise-resolve-with-itself.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,19 +21,20 @@
|
| // (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 a call to array.sort(compareFunction) works correctly for numeric comparisons (arg1 - arg2), and also for things that might look like numeric comparisons."
|
| -);
|
| +// Flags: --harmony
|
| +'use strict';
|
| +description('Test whether Promise will be rejected if it is resolved with itself.');
|
|
|
| -function doSort(x, y)
|
| -{
|
| - return x - y;
|
| -}
|
| +var resolve;
|
| +var result;
|
|
|
| -function dontSort(w, x, y)
|
| -{
|
| - return x - y;
|
| -}
|
| +var promise = new Promise(function(r) { resolve = r; });
|
| +promise.then(function () {
|
| + testFailed('fulfilled');
|
| +}, function (error) {
|
| + testPassed('rejected');
|
| + result = error.toString();
|
| + shouldBeEqualToString('result', 'TypeError: Chaining cycle detected for promise #<Promise>');
|
| +}).then(finishJSTest, finishJSTest);
|
|
|
| -shouldBe("[3,1,5,2,4].sort(doSort)", "[1,2,3,4,5]");
|
| -shouldBe("[3,1,5,2,4].sort(dontSort)", "[3,1,5,2,4]");
|
| +resolve(promise);
|
|
|