summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Array/prototype/sort/bug_596_1.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Array/prototype/sort/bug_596_1.js')
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/sort/bug_596_1.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Array/prototype/sort/bug_596_1.js b/js/src/tests/test262/built-ins/Array/prototype/sort/bug_596_1.js
new file mode 100644
index 0000000000..0298cbc442
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/sort/bug_596_1.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2014 Thomas Dahlstrom. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.sort
+description: >
+ The SortCompare abstract operation calls ToString() for identical
+ elements (step 14/15)
+author: Thomas Dahlstrom (tdahlstrom@gmail.com)
+---*/
+
+var counter = 0;
+var object = {
+ toString: function() {
+ counter++;
+ return "";
+ }
+};
+
+[object, object].sort();
+if (counter < 2) {
+ // sort calls ToString() for each element at least once
+ throw new Test262Error('#1: [object, object].sort(); counter < 2. Actual: ' + (counter));
+}
+
+reportCompare(0, 0);