mirror of
https://github.com/tc39/test262.git
synced 2025-07-22 21:45:04 +02:00
Remove unused return value from testWithIntlConstructors
This commit is contained in:
parent
f87aeab893
commit
e65c65c293
@ -14,25 +14,21 @@ author: Norbert Lindenberg
|
||||
|
||||
/**
|
||||
* @description Calls the provided function for every service constructor in
|
||||
* the Intl object, until f returns a falsy value. It returns the result of the
|
||||
* last call to f, mapped to a boolean.
|
||||
* the Intl object.
|
||||
* @param {Function} f the function to call for each service constructor in
|
||||
* the Intl object.
|
||||
* @param {Function} Constructor the constructor object to test with.
|
||||
* @result {Boolean} whether the test succeeded.
|
||||
*/
|
||||
function testWithIntlConstructors(f) {
|
||||
var constructors = ["Collator", "NumberFormat", "DateTimeFormat"];
|
||||
return constructors.every(function (constructor) {
|
||||
constructors.forEach(function (constructor) {
|
||||
var Constructor = Intl[constructor];
|
||||
var result;
|
||||
try {
|
||||
result = f(Constructor);
|
||||
f(Constructor);
|
||||
} catch (e) {
|
||||
e.message += " (Testing with " + constructor + ".)";
|
||||
throw e;
|
||||
}
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -34,5 +34,4 @@ testWithIntlConstructors(function (Constructor) {
|
||||
// this must not throw an exception for a valid language tag
|
||||
var obj = new Constructor([tag]);
|
||||
});
|
||||
return true;
|
||||
});
|
||||
|
@ -30,5 +30,4 @@ testWithIntlConstructors(function (Constructor) {
|
||||
var obj = new Constructor([tag]);
|
||||
}, "Invalid language tag " + tag + " was not rejected.");
|
||||
});
|
||||
return true;
|
||||
});
|
||||
|
@ -36,5 +36,4 @@ testWithIntlConstructors(function (Constructor) {
|
||||
var obj = new Constructor([tag]);
|
||||
}, "Invalid language tag " + tag + " was not rejected.");
|
||||
});
|
||||
return true;
|
||||
});
|
||||
|
@ -55,5 +55,4 @@ testWithIntlConstructors(function (Constructor) {
|
||||
var supported = Constructor.supportedLocalesOf([tag]);
|
||||
assert(supported.length === 0 || supported[0] === canonicalizedTags[tag][0], "For " + tag + " got " + supported[0] + "; expected " + canonicalizedTags[tag][0] + ".");
|
||||
});
|
||||
return true;
|
||||
});
|
||||
|
@ -13,5 +13,4 @@ includes: [testIntl.js]
|
||||
testWithIntlConstructors(function (Constructor) {
|
||||
var defaultLocale = new Constructor().resolvedOptions().locale;
|
||||
assert(isCanonicalizedStructurallyValidLanguageTag(defaultLocale), "Default locale \"" + defaultLocale + "\" is not canonicalized and structurally valid language tag.");
|
||||
return true;
|
||||
});
|
||||
|
@ -16,5 +16,4 @@ testWithIntlConstructors(function (Constructor) {
|
||||
assert.sameValue(supportedForUndefined.length, supportedForEmptyList.length, "Supported locales differ between undefined and empty list input.");
|
||||
// we don't compare the elements because length should be 0 - let's just verify that
|
||||
assert.sameValue(supportedForUndefined.length, 0, "Internal test error: Assumption about length being 0 is invalid.");
|
||||
return true;
|
||||
});
|
||||
|
@ -68,6 +68,4 @@ testWithIntlConstructors(function (Constructor) {
|
||||
assert.sameValue(error1.name, error2.name, "Single locale string " + locale + " results in error " + error1.name + ", but locale list [" + locale + "] results in error " + error2.name + ".");
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
});
|
||||
|
@ -28,6 +28,4 @@ testWithIntlConstructors(function (Constructor) {
|
||||
assert.sameValue(supportedForNumber.length, supportedForEmptyList.length, "Supported locales differ between numeric and empty list input.");
|
||||
var supportedForBoolean = Constructor.supportedLocalesOf(true);
|
||||
assert.sameValue(supportedForBoolean.length, supportedForEmptyList.length, "Supported locales differ between boolean and empty list input.");
|
||||
|
||||
return true;
|
||||
});
|
||||
|
@ -16,6 +16,4 @@ testWithIntlConstructors(function (Constructor) {
|
||||
var supported = Constructor.supportedLocalesOf([value]);
|
||||
}, "" + value + " as locale was not rejected.");
|
||||
});
|
||||
|
||||
return true;
|
||||
});
|
||||
|
@ -32,6 +32,4 @@ testWithIntlConstructors(function (Constructor) {
|
||||
var supported = Constructor.supportedLocalesOf(unsupportedByConstructor,
|
||||
{localeMatcher: "lookup"});
|
||||
assert.sameValue(supported.length > 0, false, "Locale " + supported[0] + " is returned by supportedLocalesOf but not by resolvedOptions.");
|
||||
|
||||
return true;
|
||||
});
|
||||
|
@ -15,6 +15,4 @@ taintProperties(["locale", "extension", "extensionIndex"]);
|
||||
testWithIntlConstructors(function (Constructor) {
|
||||
var locale = new Constructor(undefined, {localeMatcher: "lookup"}).resolvedOptions().locale;
|
||||
assert(isCanonicalizedStructurallyValidLanguageTag(locale), "Constructor returns invalid locale " + locale + ".");
|
||||
|
||||
return true;
|
||||
});
|
||||
|
@ -15,6 +15,4 @@ taintProperties(["dataLocale", "nu", "ca", "co", "locale"]);
|
||||
testWithIntlConstructors(function (Constructor) {
|
||||
var locale = new Constructor(undefined, {localeMatcher: "lookup"}).resolvedOptions().locale;
|
||||
assert(isCanonicalizedStructurallyValidLanguageTag(locale), "Constructor returns invalid locale " + locale + ".");
|
||||
|
||||
return true;
|
||||
});
|
||||
|
@ -20,6 +20,4 @@ testWithIntlConstructors(function (Constructor) {
|
||||
{localeMatcher: matcher});
|
||||
assert.sameValue(canonicalized.length > 1, false, "Canonicalization with matcher " + matcher + " didn't remove duplicate language tags from locale list.");
|
||||
});
|
||||
|
||||
return true;
|
||||
});
|
||||
|
@ -16,6 +16,4 @@ testWithIntlConstructors(function (Constructor) {
|
||||
var supported = Constructor.supportedLocalesOf([], {localeMatcher: matcher});
|
||||
assert.sameValue(supported.length, 0, "SupportedLocales with matcher " + matcher + " returned a non-empty list for an empty list.");
|
||||
});
|
||||
|
||||
return true;
|
||||
});
|
||||
|
@ -35,6 +35,4 @@ testWithIntlConstructors(function (Constructor) {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return true;
|
||||
});
|
||||
|
@ -21,6 +21,4 @@ testWithIntlConstructors(function (Constructor) {
|
||||
assert.sameValue(supported.indexOf(noLinguisticContent), -1, "SupportedLocales returned the \"no linguistic content\" locale with matcher " + matcher + ".");
|
||||
assert.sameValue(supported.length > 1, false, "SupportedLocales returned stray locales: " + supported.join(", ") + " with matcher " + matcher + ".");
|
||||
});
|
||||
|
||||
return true;
|
||||
});
|
||||
|
@ -22,6 +22,4 @@ testWithIntlConstructors(function (Constructor) {
|
||||
var supported = Constructor.supportedLocalesOf([defaultLocale], {localeMatcher: value});
|
||||
}, "Invalid localeMatcher value " + value + " was not rejected.");
|
||||
});
|
||||
|
||||
return true;
|
||||
});
|
||||
|
@ -24,6 +24,4 @@ testWithIntlConstructors(function (Constructor) {
|
||||
testFrozenProperty(supported, i);
|
||||
}
|
||||
testFrozenProperty(supported, "length");
|
||||
|
||||
return true;
|
||||
});
|
||||
|
@ -20,6 +20,4 @@ testWithIntlConstructors(function (Constructor) {
|
||||
obj = Constructor();
|
||||
newObj = Intl.Collator.call(obj);
|
||||
assert.notSameValue(obj, newObj, "Collator object created with constructor as function was not ignored as this-value.");
|
||||
|
||||
return true;
|
||||
});
|
||||
|
@ -12,7 +12,7 @@ includes: [testIntl.js]
|
||||
|
||||
testWithIntlConstructors(function (Constructor) {
|
||||
if (Constructor === Intl.DateTimeFormat)
|
||||
return true;
|
||||
return;
|
||||
|
||||
var obj, newObj;
|
||||
|
||||
@ -25,6 +25,4 @@ testWithIntlConstructors(function (Constructor) {
|
||||
obj = Constructor();
|
||||
newObj = Intl.DateTimeFormat.call(obj);
|
||||
assert.notSameValue(obj, newObj, "DateTimeFormat object created with constructor as function was not ignored as this-value.");
|
||||
|
||||
return true;
|
||||
});
|
||||
|
@ -12,7 +12,7 @@ includes: [testIntl.js]
|
||||
|
||||
testWithIntlConstructors(function (Constructor) {
|
||||
if (Constructor === Intl.NumberFormat)
|
||||
return true;
|
||||
return;
|
||||
|
||||
var obj, newObj;
|
||||
|
||||
@ -25,6 +25,4 @@ testWithIntlConstructors(function (Constructor) {
|
||||
obj = Constructor();
|
||||
newObj = Intl.NumberFormat.call(obj);
|
||||
assert.notSameValue(obj, newObj, "NumberFormat object created with constructor as function was not ignored as this-value.");
|
||||
|
||||
return true;
|
||||
});
|
||||
|
@ -22,6 +22,4 @@ testWithIntlConstructors(function (Constructor) {
|
||||
assert.throws(TypeError, function() {
|
||||
Intl.PluralRules.call(obj)
|
||||
}, "Intl.PluralRules throws when called as a function with an Intl-object as this-value");
|
||||
|
||||
return true;
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user