diff options
Diffstat (limited to 'js/src/tests/test262/intl402/NumberFormat/prototype/format/value-arg-coerced-to-number.js')
-rw-r--r-- | js/src/tests/test262/intl402/NumberFormat/prototype/format/value-arg-coerced-to-number.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/NumberFormat/prototype/format/value-arg-coerced-to-number.js b/js/src/tests/test262/intl402/NumberFormat/prototype/format/value-arg-coerced-to-number.js new file mode 100644 index 0000000000..da25c9c5f0 --- /dev/null +++ b/js/src/tests/test262/intl402/NumberFormat/prototype/format/value-arg-coerced-to-number.js @@ -0,0 +1,26 @@ +// Copyright 2012 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.3.2_1_a_ii +description: > + Tests that Intl.NumberFormat.prototype.format converts other + types to numbers. +author: Roozbeh Pournader +---*/ + +var formatter = new Intl.NumberFormat(); +var testData = [undefined, null, true, '0.6666666', {valueOf: function () { return '0.1234567';}}]; +var number; +var i, input, correctResult, result; + +for (i in testData) { + input = testData[i]; + number = +input; + correctResult = formatter.format(number); + + result = formatter.format(input); + assert.sameValue(result, correctResult, 'Intl.NumberFormat does not convert other types to numbers. Input: "' + input + '".'); +} + +reportCompare(0, 0); |