test262/test/intl402/11.1.2.1_4.js

23 lines
811 B
JavaScript
Raw Normal View History

// Copyright 2012 Mozilla Corporation. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
2014-07-25 00:41:42 +02:00
es5id: 11.1.2.1_4
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;
});