tor-browser

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

currency-code-invalid.js (720B)


      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_b
      6 description: Tests that invalid currency codes are not accepted.
      7 author: Norbert Lindenberg
      8 ---*/
      9 
     10 var invalidCurrencyCodes = [
     11    "",
     12    "€",
     13    "$",
     14    "SFr.",
     15    "DM",
     16    "KR₩",
     17    "702",
     18    "ßP",
     19    "ınr"
     20 ];
     21 
     22 invalidCurrencyCodes.forEach(function (code) {
     23    // this must throw an exception for an invalid currency code
     24    assert.throws(RangeError, function() {
     25        var format = new Intl.NumberFormat(["de-de"], {style: "currency", currency: code});
     26    }, "Invalid currency code '" + code + "' was not rejected.");
     27 });
     28 
     29 reportCompare(0, 0);