mirror of https://github.com/tc39/test262.git
Inline testValidDateTimeComponentValue into single test using this function
This commit is contained in:
parent
064ce66a5b
commit
48173672f2
|
@ -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
|
||||
|
|
|
@ -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 +
|
||||
|
|
Loading…
Reference in New Issue