From 48173672f2c39bac6835ad4e07cc758d70f18b0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 21 Dec 2017 12:08:14 -0800 Subject: [PATCH] Inline testValidDateTimeComponentValue into single test using this function --- harness/testIntl.js | 16 ---------------- test/intl402/DateTimeFormat/12.2.3_c.js | 10 +++------- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/harness/testIntl.js b/harness/testIntl.js index d799ecd88e..158feb53ae 100644 --- a/harness/testIntl.js +++ b/harness/testIntl.js @@ -1097,22 +1097,6 @@ function getDateTimeComponentValues(component) { } -/** - * Tests that the given value is valid for the given date-time component. - * @param {string} component a date-time component. - * @param {string} value the value to be tested. - * @return {boolean} true if the test succeeds. - * @exception if the test fails. - */ - -function testValidDateTimeComponentValue(component, value) { - if (getDateTimeComponentValues(component).indexOf(value) === -1) { - $ERROR("Invalid value " + value + " for date-time component " + component + "."); - } - return true; -} - - /** * @description Tests whether timeZone is a String value representing a * structurally valid and canonicalized time zone name, as defined in diff --git a/test/intl402/DateTimeFormat/12.2.3_c.js b/test/intl402/DateTimeFormat/12.2.3_c.js index 340b8767ce..571f9a01b9 100644 --- a/test/intl402/DateTimeFormat/12.2.3_c.js +++ b/test/intl402/DateTimeFormat/12.2.3_c.js @@ -32,13 +32,9 @@ locales.forEach(function (locale) { "Unrequested component " + component + " added to requested subset " + JSON.stringify(subset) + "; locale " + locale + "."); - try { - testValidDateTimeComponentValue(component, actual[component]); - } catch (e) { - e.message += " (Testing locale " + locale + "; subset " + - JSON.stringify(subset) + ")"; - throw e; - } + assert.notSameValue(getDateTimeComponentValues(component).indexOf(actual[component]), -1, + "Invalid value " + actual[component] + " for date-time component " + component + "." + + " (Testing locale " + locale + "; subset " + JSON.stringify(subset) + ")"); } else { assert.sameValue(subset.hasOwnProperty(component), false, "Missing component " + component +