From e65c65c293c2f7cf8b775704aa26579989ea1514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 21 Dec 2017 12:08:09 -0800 Subject: [PATCH] Remove unused return value from testWithIntlConstructors --- harness/testIntl.js | 10 +++------- test/intl402/6.2.2_a.js | 1 - test/intl402/6.2.2_b.js | 1 - test/intl402/6.2.2_c.js | 1 - test/intl402/6.2.3_a.js | 1 - test/intl402/6.2.4.js | 1 - test/intl402/9.2.1_1.js | 1 - test/intl402/9.2.1_3.js | 2 -- test/intl402/9.2.1_4.js | 2 -- test/intl402/9.2.1_8_c_ii.js | 2 -- test/intl402/9.2.2.js | 2 -- test/intl402/9.2.3_5.js | 2 -- test/intl402/9.2.5_6.js | 2 -- test/intl402/9.2.6_2.js | 2 -- test/intl402/9.2.6_4.js | 2 -- test/intl402/9.2.6_4_b.js | 2 -- test/intl402/9.2.6_4_c.js | 2 -- test/intl402/9.2.8_1_c.js | 2 -- test/intl402/9.2.8_4.js | 2 -- test/intl402/Collator/10.1.1_1.js | 2 -- test/intl402/DateTimeFormat/12.1.1_1.js | 4 +--- test/intl402/NumberFormat/11.1.1_1.js | 4 +--- test/intl402/PluralRules/undefined-newtarget-throws.js | 2 -- 23 files changed, 5 insertions(+), 47 deletions(-) diff --git a/harness/testIntl.js b/harness/testIntl.js index 5311939bc7..4fd4f4348c 100644 --- a/harness/testIntl.js +++ b/harness/testIntl.js @@ -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; }); } diff --git a/test/intl402/6.2.2_a.js b/test/intl402/6.2.2_a.js index 44c62c5fd6..1e615c6152 100644 --- a/test/intl402/6.2.2_a.js +++ b/test/intl402/6.2.2_a.js @@ -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; }); diff --git a/test/intl402/6.2.2_b.js b/test/intl402/6.2.2_b.js index e77e42b395..f948757d75 100644 --- a/test/intl402/6.2.2_b.js +++ b/test/intl402/6.2.2_b.js @@ -30,5 +30,4 @@ testWithIntlConstructors(function (Constructor) { var obj = new Constructor([tag]); }, "Invalid language tag " + tag + " was not rejected."); }); - return true; }); diff --git a/test/intl402/6.2.2_c.js b/test/intl402/6.2.2_c.js index 7b3bcb1dca..e4f356c257 100644 --- a/test/intl402/6.2.2_c.js +++ b/test/intl402/6.2.2_c.js @@ -36,5 +36,4 @@ testWithIntlConstructors(function (Constructor) { var obj = new Constructor([tag]); }, "Invalid language tag " + tag + " was not rejected."); }); - return true; }); diff --git a/test/intl402/6.2.3_a.js b/test/intl402/6.2.3_a.js index 91a316aec0..6827fe34a8 100644 --- a/test/intl402/6.2.3_a.js +++ b/test/intl402/6.2.3_a.js @@ -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; }); diff --git a/test/intl402/6.2.4.js b/test/intl402/6.2.4.js index a95c56c601..42ed9773db 100644 --- a/test/intl402/6.2.4.js +++ b/test/intl402/6.2.4.js @@ -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; }); diff --git a/test/intl402/9.2.1_1.js b/test/intl402/9.2.1_1.js index 3131615a64..6faebd842f 100644 --- a/test/intl402/9.2.1_1.js +++ b/test/intl402/9.2.1_1.js @@ -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; }); diff --git a/test/intl402/9.2.1_3.js b/test/intl402/9.2.1_3.js index d9f272c7ce..e20bc6e281 100644 --- a/test/intl402/9.2.1_3.js +++ b/test/intl402/9.2.1_3.js @@ -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; }); diff --git a/test/intl402/9.2.1_4.js b/test/intl402/9.2.1_4.js index e4952c4037..86c99f4f4e 100644 --- a/test/intl402/9.2.1_4.js +++ b/test/intl402/9.2.1_4.js @@ -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; }); diff --git a/test/intl402/9.2.1_8_c_ii.js b/test/intl402/9.2.1_8_c_ii.js index 4c759dc94c..d287237163 100644 --- a/test/intl402/9.2.1_8_c_ii.js +++ b/test/intl402/9.2.1_8_c_ii.js @@ -16,6 +16,4 @@ testWithIntlConstructors(function (Constructor) { var supported = Constructor.supportedLocalesOf([value]); }, "" + value + " as locale was not rejected."); }); - - return true; }); diff --git a/test/intl402/9.2.2.js b/test/intl402/9.2.2.js index 5e35d53d48..66d28bb8e1 100644 --- a/test/intl402/9.2.2.js +++ b/test/intl402/9.2.2.js @@ -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; }); diff --git a/test/intl402/9.2.3_5.js b/test/intl402/9.2.3_5.js index 17f477e99b..9b0c8256bd 100644 --- a/test/intl402/9.2.3_5.js +++ b/test/intl402/9.2.3_5.js @@ -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; }); diff --git a/test/intl402/9.2.5_6.js b/test/intl402/9.2.5_6.js index dfe30a5fd3..320e2077b2 100644 --- a/test/intl402/9.2.5_6.js +++ b/test/intl402/9.2.5_6.js @@ -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; }); diff --git a/test/intl402/9.2.6_2.js b/test/intl402/9.2.6_2.js index 327d419205..77ce413982 100644 --- a/test/intl402/9.2.6_2.js +++ b/test/intl402/9.2.6_2.js @@ -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; }); diff --git a/test/intl402/9.2.6_4.js b/test/intl402/9.2.6_4.js index f6e68ac748..7dc4e855cb 100644 --- a/test/intl402/9.2.6_4.js +++ b/test/intl402/9.2.6_4.js @@ -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; }); diff --git a/test/intl402/9.2.6_4_b.js b/test/intl402/9.2.6_4_b.js index 13c371b04b..d94bf4d1fc 100644 --- a/test/intl402/9.2.6_4_b.js +++ b/test/intl402/9.2.6_4_b.js @@ -35,6 +35,4 @@ testWithIntlConstructors(function (Constructor) { } }); }); - - return true; }); diff --git a/test/intl402/9.2.6_4_c.js b/test/intl402/9.2.6_4_c.js index c8d81e7ddd..87c76a3eac 100644 --- a/test/intl402/9.2.6_4_c.js +++ b/test/intl402/9.2.6_4_c.js @@ -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; }); diff --git a/test/intl402/9.2.8_1_c.js b/test/intl402/9.2.8_1_c.js index cf863071c5..f35ecca3a6 100644 --- a/test/intl402/9.2.8_1_c.js +++ b/test/intl402/9.2.8_1_c.js @@ -22,6 +22,4 @@ testWithIntlConstructors(function (Constructor) { var supported = Constructor.supportedLocalesOf([defaultLocale], {localeMatcher: value}); }, "Invalid localeMatcher value " + value + " was not rejected."); }); - - return true; }); diff --git a/test/intl402/9.2.8_4.js b/test/intl402/9.2.8_4.js index be3eb18ac3..0244c2e54a 100644 --- a/test/intl402/9.2.8_4.js +++ b/test/intl402/9.2.8_4.js @@ -24,6 +24,4 @@ testWithIntlConstructors(function (Constructor) { testFrozenProperty(supported, i); } testFrozenProperty(supported, "length"); - - return true; }); diff --git a/test/intl402/Collator/10.1.1_1.js b/test/intl402/Collator/10.1.1_1.js index faab9aceec..9aad93df3b 100644 --- a/test/intl402/Collator/10.1.1_1.js +++ b/test/intl402/Collator/10.1.1_1.js @@ -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; }); diff --git a/test/intl402/DateTimeFormat/12.1.1_1.js b/test/intl402/DateTimeFormat/12.1.1_1.js index 88bae8a805..0aa96266be 100644 --- a/test/intl402/DateTimeFormat/12.1.1_1.js +++ b/test/intl402/DateTimeFormat/12.1.1_1.js @@ -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; }); diff --git a/test/intl402/NumberFormat/11.1.1_1.js b/test/intl402/NumberFormat/11.1.1_1.js index d8ea319a93..05c1649569 100644 --- a/test/intl402/NumberFormat/11.1.1_1.js +++ b/test/intl402/NumberFormat/11.1.1_1.js @@ -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; }); diff --git a/test/intl402/PluralRules/undefined-newtarget-throws.js b/test/intl402/PluralRules/undefined-newtarget-throws.js index 672f0c9e2c..e43ea6674a 100644 --- a/test/intl402/PluralRules/undefined-newtarget-throws.js +++ b/test/intl402/PluralRules/undefined-newtarget-throws.js @@ -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; });