js/src/tests/test262/intl402/ch11/11.1/11.1.1_19.js

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

     1 // Copyright 2012 Mozilla Corporation. All rights reserved.
     2 // This code is governed by the BSD license found in the LICENSE file.
     4 /**
     5  * @description Tests that the currency style can not be used without a specified currency.
     6  * @author Norbert Lindenberg
     7  */
     9 var defaultLocale = new Intl.NumberFormat().resolvedOptions().locale;
    11 function expectError(f) {
    12     var error;
    13     try {
    14         f();
    15     } catch (e) {
    16         error = e;
    17     }
    18     if (error === undefined) {
    19         $ERROR("Invalid currency value " + value + " was not rejected.");
    20     } else if (error.name !== "TypeError") {
    21         $ERROR("Invalid currency value " + value + " was rejected with wrong error " + error.name + ".");
    22     }
    23 }
    25 expectError(function () {
    26         return new Intl.NumberFormat([defaultLocale], {style: "currency"});
    27 });
    28 expectError(function () {
    29         return new Intl.NumberFormat([defaultLocale + "-u-cu-krw"], {style: "currency"});
    30 });

mercurial