diff options
author | Norbert Lindenberg <ecmascript@lindenbergsoftware.com> | 2012-08-22 18:16:59 -0700 |
---|---|---|
committer | Norbert Lindenberg <ecmascript@lindenbergsoftware.com> | 2012-08-22 18:16:59 -0700 |
commit | e2223bbef68f97fd9f96b2618a051815667af7e1 (patch) | |
tree | 19be7081116703e2689056caed68bf60e6e674a9 /test/suite/intl402/ch11/11.3/11.3.2_FN_3_b.js | |
parent | 11b493d63e6aa3c05d60210d67e122a8904a293d (diff) | |
download | test262-e2223bbef68f97fd9f96b2618a051815667af7e1.tar.gz |
Moved Google tests from ch12 to ch11.
--HG--
rename : test/suite/intl402/ch12/12.2/12.2.1.js => test/suite/intl402/ch11/11.2/11.2.1.js
rename : test/suite/intl402/ch12/12.2/12.2.2.js => test/suite/intl402/ch11/11.2/11.2.2.js
rename : test/suite/intl402/ch12/12.2/12.2.3.js => test/suite/intl402/ch11/11.2/11.2.3.js
rename : test/suite/intl402/ch12/12.2/12.2.js => test/suite/intl402/ch11/11.2/11.2.js
rename : test/suite/intl402/ch12/12.3/12.3.1.js => test/suite/intl402/ch11/11.3/11.3.1.js
rename : test/suite/intl402/ch12/12.3/12.3.2_2.js => test/suite/intl402/ch11/11.3/11.3.2_1_a_ii.js
rename : test/suite/intl402/ch12/12.3/12.3.2_3.js => test/suite/intl402/ch11/11.3/11.3.2_FN_1.js
rename : test/suite/intl402/ch12/12.3/12.3.2_4.js => test/suite/intl402/ch11/11.3/11.3.2_FN_2.js
rename : test/suite/intl402/ch12/12.3/12.3.2_5_b.js => test/suite/intl402/ch11/11.3/11.3.2_FN_3_b.js
rename : test/suite/intl402/ch12/12.3/12.3.2_5_e.js => test/suite/intl402/ch11/11.3/11.3.2_FN_3_e.js
rename : test/suite/intl402/ch12/12.3/12.3.js => test/suite/intl402/ch11/11.3/11.3.js
Diffstat (limited to 'test/suite/intl402/ch11/11.3/11.3.2_FN_3_b.js')
-rw-r--r-- | test/suite/intl402/ch11/11.3/11.3.2_FN_3_b.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/suite/intl402/ch11/11.3/11.3.2_FN_3_b.js b/test/suite/intl402/ch11/11.3/11.3.2_FN_3_b.js new file mode 100644 index 000000000..efe15575d --- /dev/null +++ b/test/suite/intl402/ch11/11.3/11.3.2_FN_3_b.js @@ -0,0 +1,27 @@ +// Copyright 2012 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @description Tests that Intl.NumberFormat.prototype.format + * formats percent values properly. + * @author: Roozbeh Pournader + */ + +var numberFormatter = new Intl.NumberFormat(); +var percentFormatter = new Intl.NumberFormat(undefined, {style: 'percent'}); + +var formattedTwenty = numberFormatter.format(20); +var formattedTwentyPercent = percentFormatter.format(0.20); + +// FIXME: May not work for some theoretical locales where percents and +// normal numbers are formatted using different numbering systems. +if (formattedTwentyPercent.indexOf(formattedTwenty) === -1) { + $ERROR("Intl.NumberFormat's formatting of 20% does not include a " + + "formatting of 20 as a substring."); +} + +// FIXME: Move this to somewhere appropriate +if (percentFormatter.format(0.011) === percentFormatter.format(0.02)) { + $ERROR('Intl.NumberFormat is formatting 1.1% and 2% the same way.'); +} + |