Index: test/webkit/array-sort-numericCompare.js |
diff --git a/test/webkit/concat-while-having-a-bad-time.js b/test/webkit/array-sort-numericCompare.js |
similarity index 79% |
copy from test/webkit/concat-while-having-a-bad-time.js |
copy to test/webkit/array-sort-numericCompare.js |
index dfda1e08a0b36194b787a44ee12a9693acd8aeaf..74df82f61db4568b7791bc82188dddaba70e84f1 100644 |
--- a/test/webkit/concat-while-having-a-bad-time.js |
+++ b/test/webkit/array-sort-numericCompare.js |
@@ -22,10 +22,18 @@ |
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
description( |
-"Tests the behavior of Array.prototype.concat while the array is having a bad time due to one of the elements we are concatenating." |
+"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." |
); |
-Object.defineProperty(Array.prototype, 0, { writable: false }); |
-shouldBe("[42].concat()", "[42]"); |
+function doSort(x, y) |
+{ |
+ return x - y; |
+} |
+function dontSort(w, x, y) |
+{ |
+ return x - y; |
+} |
+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]"); |