summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/resist-fingerprinting/locale.js
blob: 6c15ca88ae1db5d74a2fbb656ec8f5ba0bc17031 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// |jit-test| skip-if: typeof Intl === 'undefined'

function test(locale, timeZone) {
  let global = newGlobal({locale, forceUTC: true});

  const constructors = ["Collator", "DateTimeFormat", "ListFormat",
                        "NumberFormat", "PluralRules", "RelativeTimeFormat"];
  for (const constructor of constructors) {
    let intl = new global.Intl[constructor];
    assertEq(intl.resolvedOptions().locale, locale);
  }

  const date = new global.Date(2012, 0, 10);
  let tzRE = /\(([^\)]+)\)/;
  assertEq(tzRE.exec(date)[1], timeZone)
}

test("de-CH", "Koordinierte Weltzeit");
test("en", "Coordinated Universal Time");