2012-11-05 23:48:52 +01:00
|
|
|
// Copyright 2012 Mozilla Corporation. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
|
2014-07-22 01:09:02 +02:00
|
|
|
/*---
|
2014-07-25 00:41:42 +02:00
|
|
|
es5id: 10.1.2.1_4
|
2014-07-22 01:09:02 +02:00
|
|
|
description: >
|
2015-07-08 19:13:06 +02:00
|
|
|
Tests that non-object values passed as this to Collator are ignored
|
|
|
|
and a normal collator object will be initialized and returned.
|
2014-07-22 01:09:02 +02:00
|
|
|
author: Norbert Lindenberg
|
|
|
|
---*/
|
2012-11-05 23:48:52 +01:00
|
|
|
|
|
|
|
var thisValues = [true, 42, "国際化"];
|
|
|
|
|
|
|
|
thisValues.forEach(function (value) {
|
|
|
|
var collator = Intl.Collator.call(value);
|
|
|
|
// check that the returned object functions as a collator
|
|
|
|
var referenceCollator = new Intl.Collator();
|
|
|
|
if (Intl.Collator.prototype.compare.call(collator, "a", "b") !== referenceCollator.compare("a", "b")) {
|
|
|
|
$ERROR("Collator initialized from " + value + " doesn't behave like normal collator.");
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
});
|