aboutsummaryrefslogtreecommitdiffstats
path: root/test/suite/intl402/ch13/13.1/13.1.1_1.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/suite/intl402/ch13/13.1/13.1.1_1.js')
-rw-r--r--test/suite/intl402/ch13/13.1/13.1.1_1.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/suite/intl402/ch13/13.1/13.1.1_1.js b/test/suite/intl402/ch13/13.1/13.1.1_1.js
new file mode 100644
index 000000000..37be9711b
--- /dev/null
+++ b/test/suite/intl402/ch13/13.1/13.1.1_1.js
@@ -0,0 +1,24 @@
+// Copyright 2012 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * @description Tests that localeCompare rejects values that can't be coerced to an object.
+ * @author Norbert Lindenberg
+ */
+
+var invalidValues = [undefined, null];
+
+invalidValues.forEach(function (value) {
+ var error;
+ try {
+ var result = String.prototype.localeCompare.call(value, "");
+ } catch (e) {
+ error = e;
+ }
+ if (error === undefined) {
+ $ERROR("String.prototype.localeCompare did not reject this = " + value + ".");
+ } else if (error.name !== "TypeError") {
+ $ERROR("String.prototype.localeCompare rejected this = " + value + " with wrong error " + error.name + ".");
+ }
+});
+