Inline testValidDateTimeComponentValue into single test using this function

This commit is contained in:
André Bargull 2017-12-21 12:08:14 -08:00 committed by Rick Waldron
parent 064ce66a5b
commit 48173672f2
2 changed files with 3 additions and 23 deletions

View File

@ -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

View File

@ -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 +