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
|
* @description Tests whether timeZone is a String value representing a
|
||||||
* structurally valid and canonicalized time zone name, as defined in
|
* structurally valid and canonicalized time zone name, as defined in
|
||||||
|
|
|
@ -32,13 +32,9 @@ locales.forEach(function (locale) {
|
||||||
"Unrequested component " + component +
|
"Unrequested component " + component +
|
||||||
" added to requested subset " + JSON.stringify(subset) +
|
" added to requested subset " + JSON.stringify(subset) +
|
||||||
"; locale " + locale + ".");
|
"; locale " + locale + ".");
|
||||||
try {
|
assert.notSameValue(getDateTimeComponentValues(component).indexOf(actual[component]), -1,
|
||||||
testValidDateTimeComponentValue(component, actual[component]);
|
"Invalid value " + actual[component] + " for date-time component " + component + "." +
|
||||||
} catch (e) {
|
" (Testing locale " + locale + "; subset " + JSON.stringify(subset) + ")");
|
||||||
e.message += " (Testing locale " + locale + "; subset " +
|
|
||||||
JSON.stringify(subset) + ")";
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
assert.sameValue(subset.hasOwnProperty(component), false,
|
assert.sameValue(subset.hasOwnProperty(component), false,
|
||||||
"Missing component " + component +
|
"Missing component " + component +
|
||||||
|
|
Loading…
Reference in New Issue