tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

currency-code-well-formed.js (741B)


      1 // Copyright 2012 Mozilla Corporation. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 es5id: 6.3.1_a
      6 description: Tests that well-formed currency codes are accepted.
      7 author: Norbert Lindenberg
      8 ---*/
      9 
     10 var wellFormedCurrencyCodes = [
     11    "BOB",
     12    "EUR",
     13    "usd", // currency codes are case-insensitive
     14    "XdR",
     15    "xTs"
     16 ];
     17 
     18 wellFormedCurrencyCodes.forEach(function (code) {
     19    // this must not throw an exception for a valid currency code
     20    var format = new Intl.NumberFormat(["de-de"], {style: "currency", currency: code});
     21    assert.sameValue(format.resolvedOptions().currency, code.toUpperCase(), "Currency " + code + " was not correctly accepted.");
     22 });
     23 
     24 reportCompare(0, 0);