summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/String/prototype/localeCompare/15.5.4.9_3.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/String/prototype/localeCompare/15.5.4.9_3.js')
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/localeCompare/15.5.4.9_3.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/String/prototype/localeCompare/15.5.4.9_3.js b/js/src/tests/test262/built-ins/String/prototype/localeCompare/15.5.4.9_3.js
new file mode 100644
index 0000000000..35f29b09bf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/localeCompare/15.5.4.9_3.js
@@ -0,0 +1,25 @@
+// Copyright 2013 Mozilla Corporation. All rights reserved.
+// This code is governed by the license found in the LICENSE file.
+
+/*---
+es5id: 15.5.4.9_3
+description: >
+ Tests that String.prototype.localeCompare treats a missing "that"
+ argument, undefined, and "undefined" as equivalent.
+author: Norbert Lindenberg
+---*/
+
+var thisValues = ["a", "t", "u", "undefined", "UNDEFINED", "nicht definiert", "xyz", "未定义"];
+
+var i;
+for (i = 0; i < thisValues.length; i++) {
+ var thisValue = thisValues[i];
+ if (thisValue.localeCompare() !== thisValue.localeCompare(undefined)) {
+ throw new Test262Error("String.prototype.localeCompare does not treat missing 'that' argument as undefined.");
+ }
+ if (thisValue.localeCompare(undefined) !== thisValue.localeCompare("undefined")) {
+ throw new Test262Error("String.prototype.localeCompare does not treat undefined 'that' argument as \"undefined\".");
+ }
+}
+
+reportCompare(0, 0);