Skip to content

Commit

Permalink
Transform compareArray -> assert.compareArray: test/intl402/**/*.js (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaldron authored Oct 6, 2021
1 parent ed91c59 commit d5ac0c3
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 18 deletions.
7 changes: 3 additions & 4 deletions test/intl402/Intl/getCanonicalLocales/duplicates.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ info: |
includes: [compareArray.js]
---*/

assert(compareArray(
Intl.getCanonicalLocales(
['ab-cd', 'ff', 'de-rt', 'ab-Cd']), ['ab-CD', 'ff', 'de-RT']));
assert.compareArray(Intl.getCanonicalLocales(
['ab-cd', 'ff', 'de-rt', 'ab-Cd']), ['ab-CD', 'ff', 'de-RT']);

var locales = Intl.getCanonicalLocales(['en-US', 'en-US']);
assert(compareArray(locales, ['en-US']), 'en-US');
assert.compareArray(locales, ['en-US'], 'en-US');
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ features: [Symbol]
var gCL = Intl.getCanonicalLocales;

function assertArray(l, r) {
assert(compareArray(l, r), r);
assert.compareArray(l, r, r);
}

assertArray(gCL(), []);
Expand Down
2 changes: 1 addition & 1 deletion test/intl402/Intl/getCanonicalLocales/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ includes: [compareArray.js]
var gCL = Intl.getCanonicalLocales;

function assertArray(l, r) {
assert(compareArray(l, r), r);
assert.compareArray(l, r, r);
}

assertArray(gCL(), []);
Expand Down
28 changes: 20 additions & 8 deletions test/intl402/Intl/getCanonicalLocales/overriden-arg-length.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ Object.defineProperty(locales, "length", {
get: function() { return "1" }
});

assert(compareArray(Intl.getCanonicalLocales(locales), ['en-US']),
"should return one element if locales.length is '1'");
assert.compareArray(
Intl.getCanonicalLocales(locales),
['en-US'],
"should return one element if locales.length is '1'"
);

var locales = {
'0': 'en-US',
Expand All @@ -44,8 +47,11 @@ Object.defineProperty(locales, "length", {
get: function() { return 1.3 }
});

assert(compareArray(Intl.getCanonicalLocales(locales), ['en-US']),
"should return one element if locales.length is 1.3");
assert.compareArray(
Intl.getCanonicalLocales(locales),
['en-US'],
"should return one element if locales.length is 1.3"
);

var locales = {
'0': 'en-US',
Expand All @@ -69,8 +75,11 @@ Object.defineProperty(locales, "length", {
get: function() { return -Infinity }
});

assert(compareArray(Intl.getCanonicalLocales(locales), []),
"should return empty array if locales.length is -Infinity");
assert.compareArray(
Intl.getCanonicalLocales(locales),
[],
"should return empty array if locales.length is -Infinity"
);

var locales = {
length: -Math.pow(2, 32) + 1
Expand All @@ -80,8 +89,11 @@ Object.defineProperty(locales, "0", {
get: function() { throw new Error("must not be gotten!"); }
})

assert(compareArray(Intl.getCanonicalLocales(locales), []),
"should return empty array if locales.length is a negative value");
assert.compareArray(
Intl.getCanonicalLocales(locales),
[],
"should return empty array if locales.length is a negative value"
);

var count = 0;
var locs = { get length() { if (count++ > 0) throw 42; return 0; } };
Expand Down
2 changes: 1 addition & 1 deletion test/intl402/Intl/getCanonicalLocales/overriden-push.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ Array.prototype.push = function() { throw 42; };
// must not throw 42, might if push is used
var arr = Intl.getCanonicalLocales(["en-US"]);

assert(compareArray(arr, ["en-US"]));
assert.compareArray(arr, ["en-US"]);
2 changes: 1 addition & 1 deletion test/intl402/Intl/getCanonicalLocales/to-string.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ var locales = {
length: 2
};

assert(compareArray(Intl.getCanonicalLocales(locales), [ "en-US", "pt-BR" ]));
assert.compareArray(Intl.getCanonicalLocales(locales), [ "en-US", "pt-BR" ]);
2 changes: 1 addition & 1 deletion test/intl402/Intl/getCanonicalLocales/weird-cases.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ var weirdCases =
];

weirdCases.forEach(function (weird) {
assert(compareArray(Intl.getCanonicalLocales(weird), [weird]));
assert.compareArray(Intl.getCanonicalLocales(weird), [weird]);
});
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ includes: [compareArray.js]

let lf = new Intl.ListFormat();

assert(compareArray([], lf.formatToParts(undefined)));
assert.compareArray([], lf.formatToParts(undefined));

0 comments on commit d5ac0c3

Please sign in to comment.