summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/String/prototype/localeCompare/missing-arguments-coerced-to-undefined.js
blob: 2b80e84a897a45c8378f1dc15881db80f257acb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright 2013 Mozilla Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.

/*---
es5id: 13.1.1_3_2
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];
    assert.sameValue(thisValue.localeCompare(), thisValue.localeCompare(undefined), "String.prototype.localeCompare does not treat missing 'that' argument as undefined.");
    assert.sameValue(thisValue.localeCompare(undefined), thisValue.localeCompare("undefined"), "String.prototype.localeCompare does not treat undefined 'that' argument as \"undefined\".");
}

reportCompare(0, 0);