summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/PluralRules/prototype/resolvedOptions/return-keys-order-default.js
blob: e1dda53bc63536e4bd0ea40896780ddab6414aba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright 2023 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-intl.pluralrules.prototype.resolvedoptions
description: order of property keys for the object returned by resolvedOptions()
features: [Intl.NumberFormat-v3]
includes: [compareArray.js]
---*/

const allKeys = [
    'locale',
    'type',
    'minimumIntegerDigits',
    'minimumFractionDigits',
    'maximumFractionDigits',
    'minimumSignificantDigits',
    'maximumSignificantDigits',
    'pluralCategories',
    'roundingIncrement',
    'roundingMode',
    'roundingPriority',
    'trailingZeroDisplay'
];

const options = [
    { },
    { minimumSignificantDigits: 3 },
    { minimumFractionDigits: 3 },
];
options.forEach((option) => {
    const nf = new Intl.PluralRules(undefined, option);
    const resolved = nf.resolvedOptions();
    const resolvedKeys = Reflect.ownKeys(resolved);
    const expectedKeys = allKeys.filter(key => key in resolved);
    assert.compareArray(resolvedKeys, expectedKeys,
        'resolvedOptions() property key order with options ' + JSON.stringify(options));
});

reportCompare(0, 0);