diff options
Diffstat (limited to 'test/suite/intl402/ch12/12.3/12.3.2_2.js')
-rw-r--r-- | test/suite/intl402/ch12/12.3/12.3.2_2.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/suite/intl402/ch12/12.3/12.3.2_2.js b/test/suite/intl402/ch12/12.3/12.3.2_2.js new file mode 100644 index 000000000..09fafe15d --- /dev/null +++ b/test/suite/intl402/ch12/12.3/12.3.2_2.js @@ -0,0 +1,34 @@ +// Copyright 2012 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @path intl402/ch12/12.3/12.3.2_2.js + * @description Tests that Intl.NumberFormat.prototype.format + * converts other types to numbers. + * @author: Roozbeh Pournader + */ + +var testcase = function() { + "use strict"; + + var formatter = new Intl.NumberFormat(); + var testData = [undefined, null, true, '0.6666666']; + var number; + var i, input, correctResult, result; + + for (i in testData) { + input = testData[i]; + number = +input; + correctResult = formatter.format(number); + + result = formatter.format(input); + if (result !== correctResult) { + $ERROR('Intl.NumberFormat does not convert other ' + + 'types to numbers. Input: "'+input+'" Output: "'+result+'" '+ + 'Expected output: "'+correctResult+'"'); + } + } + + return true; +} +runTestCase(testcase); |