blob: 18b5b98faf346381f41e3f49d063ac1bd3fa9106 [file] [log] [blame]
// Copyright 2012 Mozilla Corporation. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* @description Tests that for non-object values passed as this to NumberFormat a
* wrapper object will be initialized and returned.
* @author Norbert Lindenberg
*/
var thisValues = [true, 42, "国際化"];
thisValues.forEach(function (value) {
var format = Intl.NumberFormat.call(value);
// check that the returned object functions as a number format
var referenceFormat = new Intl.NumberFormat();
if (Intl.NumberFormat.prototype.format.call(format, 12.3456) !== referenceFormat.format(12.3456)) {
$ERROR("NumberFormat initialized from " + value + " doesn't behave like normal number format.");
}
return true;
});