| Index: test/webkit/fast/js/Promise-already-resolved.js
|
| diff --git a/test/webkit/sort-with-side-effecting-comparisons.js b/test/webkit/fast/js/Promise-already-resolved.js
|
| similarity index 71%
|
| copy from test/webkit/sort-with-side-effecting-comparisons.js
|
| copy to test/webkit/fast/js/Promise-already-resolved.js
|
| index 6794e322f5df200658ec6f20bc367228e8874d49..7a8640ae166544e6112a988f95392d0f5cfeed59 100644
|
| --- a/test/webkit/sort-with-side-effecting-comparisons.js
|
| +++ b/test/webkit/fast/js/Promise-already-resolved.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,23 @@
|
| // (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('Resolve or reject do not take effect on a resolved Promise.');
|
|
|
| -var array = [];
|
| +var result;
|
|
|
| -for (var i = 0; i < 20000; ++i)
|
| - array.push(i);
|
| -
|
| -array.sort(function(a, b) {
|
| - array.shift();
|
| - if (a < b)
|
| - return -1;
|
| - if (a > b)
|
| - return 1;
|
| - return 0;
|
| +new Promise(function(resolve, reject) {
|
| + var anotherResolve;
|
| + resolve(new Promise(function(r) { anotherResolve = r; }));
|
| + resolve('resolve');
|
| + reject('reject');
|
| + anotherResolve('foo');
|
| +}).then(function(localResult) {
|
| + result = localResult;
|
| + shouldBeEqualToString('result', 'foo');
|
| + finishJSTest();
|
| +}, function() {
|
| + testFailed('rejected');
|
| + finishJSTest();
|
| });
|
| -
|
| -testPassed("It worked.");
|
|
|