mirror of
https://github.com/tc39/test262.git
synced 2025-07-26 07:25:15 +02:00
Transform compareArray -> assert.compareArray: test/intl402/**/*.js (#3240)
This commit is contained in:
parent
ed91c59b94
commit
d5ac0c348a
@ -11,9 +11,8 @@ info: |
|
|||||||
includes: [compareArray.js]
|
includes: [compareArray.js]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
assert(compareArray(
|
assert.compareArray(Intl.getCanonicalLocales(
|
||||||
Intl.getCanonicalLocales(
|
['ab-cd', 'ff', 'de-rt', 'ab-Cd']), ['ab-CD', 'ff', 'de-RT']);
|
||||||
['ab-cd', 'ff', 'de-rt', 'ab-Cd']), ['ab-CD', 'ff', 'de-RT']));
|
|
||||||
|
|
||||||
var locales = Intl.getCanonicalLocales(['en-US', 'en-US']);
|
var locales = Intl.getCanonicalLocales(['en-US', 'en-US']);
|
||||||
assert(compareArray(locales, ['en-US']), 'en-US');
|
assert.compareArray(locales, ['en-US'], 'en-US');
|
||||||
|
@ -15,7 +15,7 @@ features: [Symbol]
|
|||||||
var gCL = Intl.getCanonicalLocales;
|
var gCL = Intl.getCanonicalLocales;
|
||||||
|
|
||||||
function assertArray(l, r) {
|
function assertArray(l, r) {
|
||||||
assert(compareArray(l, r), r);
|
assert.compareArray(l, r, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
assertArray(gCL(), []);
|
assertArray(gCL(), []);
|
||||||
|
@ -14,7 +14,7 @@ includes: [compareArray.js]
|
|||||||
var gCL = Intl.getCanonicalLocales;
|
var gCL = Intl.getCanonicalLocales;
|
||||||
|
|
||||||
function assertArray(l, r) {
|
function assertArray(l, r) {
|
||||||
assert(compareArray(l, r), r);
|
assert.compareArray(l, r, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
assertArray(gCL(), []);
|
assertArray(gCL(), []);
|
||||||
|
@ -32,8 +32,11 @@ Object.defineProperty(locales, "length", {
|
|||||||
get: function() { return "1" }
|
get: function() { return "1" }
|
||||||
});
|
});
|
||||||
|
|
||||||
assert(compareArray(Intl.getCanonicalLocales(locales), ['en-US']),
|
assert.compareArray(
|
||||||
"should return one element if locales.length is '1'");
|
Intl.getCanonicalLocales(locales),
|
||||||
|
['en-US'],
|
||||||
|
"should return one element if locales.length is '1'"
|
||||||
|
);
|
||||||
|
|
||||||
var locales = {
|
var locales = {
|
||||||
'0': 'en-US',
|
'0': 'en-US',
|
||||||
@ -44,8 +47,11 @@ Object.defineProperty(locales, "length", {
|
|||||||
get: function() { return 1.3 }
|
get: function() { return 1.3 }
|
||||||
});
|
});
|
||||||
|
|
||||||
assert(compareArray(Intl.getCanonicalLocales(locales), ['en-US']),
|
assert.compareArray(
|
||||||
"should return one element if locales.length is 1.3");
|
Intl.getCanonicalLocales(locales),
|
||||||
|
['en-US'],
|
||||||
|
"should return one element if locales.length is 1.3"
|
||||||
|
);
|
||||||
|
|
||||||
var locales = {
|
var locales = {
|
||||||
'0': 'en-US',
|
'0': 'en-US',
|
||||||
@ -69,8 +75,11 @@ Object.defineProperty(locales, "length", {
|
|||||||
get: function() { return -Infinity }
|
get: function() { return -Infinity }
|
||||||
});
|
});
|
||||||
|
|
||||||
assert(compareArray(Intl.getCanonicalLocales(locales), []),
|
assert.compareArray(
|
||||||
"should return empty array if locales.length is -Infinity");
|
Intl.getCanonicalLocales(locales),
|
||||||
|
[],
|
||||||
|
"should return empty array if locales.length is -Infinity"
|
||||||
|
);
|
||||||
|
|
||||||
var locales = {
|
var locales = {
|
||||||
length: -Math.pow(2, 32) + 1
|
length: -Math.pow(2, 32) + 1
|
||||||
@ -80,8 +89,11 @@ Object.defineProperty(locales, "0", {
|
|||||||
get: function() { throw new Error("must not be gotten!"); }
|
get: function() { throw new Error("must not be gotten!"); }
|
||||||
})
|
})
|
||||||
|
|
||||||
assert(compareArray(Intl.getCanonicalLocales(locales), []),
|
assert.compareArray(
|
||||||
"should return empty array if locales.length is a negative value");
|
Intl.getCanonicalLocales(locales),
|
||||||
|
[],
|
||||||
|
"should return empty array if locales.length is a negative value"
|
||||||
|
);
|
||||||
|
|
||||||
var count = 0;
|
var count = 0;
|
||||||
var locs = { get length() { if (count++ > 0) throw 42; return 0; } };
|
var locs = { get length() { if (count++ > 0) throw 42; return 0; } };
|
||||||
|
@ -16,4 +16,4 @@ Array.prototype.push = function() { throw 42; };
|
|||||||
// must not throw 42, might if push is used
|
// must not throw 42, might if push is used
|
||||||
var arr = Intl.getCanonicalLocales(["en-US"]);
|
var arr = Intl.getCanonicalLocales(["en-US"]);
|
||||||
|
|
||||||
assert(compareArray(arr, ["en-US"]));
|
assert.compareArray(arr, ["en-US"]);
|
||||||
|
@ -17,4 +17,4 @@ var locales = {
|
|||||||
length: 2
|
length: 2
|
||||||
};
|
};
|
||||||
|
|
||||||
assert(compareArray(Intl.getCanonicalLocales(locales), [ "en-US", "pt-BR" ]));
|
assert.compareArray(Intl.getCanonicalLocales(locales), [ "en-US", "pt-BR" ]);
|
||||||
|
@ -20,5 +20,5 @@ var weirdCases =
|
|||||||
];
|
];
|
||||||
|
|
||||||
weirdCases.forEach(function (weird) {
|
weirdCases.forEach(function (weird) {
|
||||||
assert(compareArray(Intl.getCanonicalLocales(weird), [weird]));
|
assert.compareArray(Intl.getCanonicalLocales(weird), [weird]);
|
||||||
});
|
});
|
||||||
|
@ -16,4 +16,4 @@ includes: [compareArray.js]
|
|||||||
|
|
||||||
let lf = new Intl.ListFormat();
|
let lf = new Intl.ListFormat();
|
||||||
|
|
||||||
assert(compareArray([], lf.formatToParts(undefined)));
|
assert.compareArray([], lf.formatToParts(undefined));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user