Replace mustNotHaveProperty with verifyProperty

This commit is contained in:
André Bargull 2017-12-21 12:08:20 -08:00 committed by Rick Waldron
parent 20ea611db7
commit ce3c3d7dbd
4 changed files with 18 additions and 31 deletions

View File

@ -873,19 +873,6 @@ function mustHaveProperty(obj, property, valid) {
}
/**
* Tests whether the given object does not have the named property.
* @param {Object} obj the object to be tested.
* @param {string} property the name of the property
* @exception if the property is present.
*/
function mustNotHaveProperty(obj, property) {
if (obj.hasOwnProperty(property)) {
$ERROR("Object has property it mustn't have: " + property + ".");
}
}
/**
* Properties of the RegExp constructor that may be affected by use of regular
* expressions, and the default values of these properties. Properties are from

View File

@ -8,7 +8,7 @@ description: >
Intl.DateTimeFormat.prototype.resolvedOptions has the right
properties.
author: Norbert Lindenberg
includes: [testIntl.js]
includes: [testIntl.js, propertyHelper.js]
---*/
var actual = new Intl.DateTimeFormat().resolvedOptions();
@ -39,13 +39,13 @@ mustHaveProperty(actual, "locale", isCanonicalizedStructurallyValidLanguageTag);
mustHaveProperty(actual, "calendar", calendars);
mustHaveProperty(actual, "numberingSystem", isValidNumberingSystem);
mustHaveProperty(actual, "timeZone", isCanonicalizedStructurallyValidTimeZoneName);
mustNotHaveProperty(actual, "weekday");
mustNotHaveProperty(actual, "era");
verifyProperty(actual, "weekday", undefined);
verifyProperty(actual, "era", undefined);
mustHaveProperty(actual, "year", ["2-digit", "numeric"]);
mustHaveProperty(actual, "month", ["2-digit", "numeric", "narrow", "short", "long"]);
mustHaveProperty(actual, "day", ["2-digit", "numeric"]);
mustNotHaveProperty(actual, "hour");
mustNotHaveProperty(actual, "minute");
mustNotHaveProperty(actual, "second");
mustNotHaveProperty(actual, "timeZoneName");
mustNotHaveProperty(actual, "hour12");
verifyProperty(actual, "hour", undefined);
verifyProperty(actual, "minute", undefined);
verifyProperty(actual, "second", undefined);
verifyProperty(actual, "timeZoneName", undefined);
verifyProperty(actual, "hour12", undefined);

View File

@ -8,7 +8,7 @@ description: >
Intl.NumberFormat.prototype.resolvedOptions has the right
properties.
author: Norbert Lindenberg
includes: [testIntl.js]
includes: [testIntl.js, propertyHelper.js]
---*/
var actual = new Intl.NumberFormat().resolvedOptions();
@ -20,11 +20,11 @@ assert.notSameValue(actual2, actual, "resolvedOptions returned the same object t
mustHaveProperty(actual, "locale", isCanonicalizedStructurallyValidLanguageTag);
mustHaveProperty(actual, "numberingSystem", isValidNumberingSystem);
mustHaveProperty(actual, "style", ["decimal"]);
mustNotHaveProperty(actual, "currency");
mustNotHaveProperty(actual, "currencyDisplay");
verifyProperty(actual, "currency", undefined);
verifyProperty(actual, "currencyDisplay", undefined);
mustHaveProperty(actual, "minimumIntegerDigits", [1]);
mustHaveProperty(actual, "minimumFractionDigits", [0]);
mustHaveProperty(actual, "maximumFractionDigits", [3]);
mustNotHaveProperty(actual, "minimumSignificantDigits");
mustNotHaveProperty(actual, "maximumSignificantDigits");
verifyProperty(actual, "minimumSignificantDigits", undefined);
verifyProperty(actual, "maximumSignificantDigits", undefined);
mustHaveProperty(actual, "useGrouping", [true]);

View File

@ -8,7 +8,7 @@ description: >
Intl.PluralRules.prototype.resolvedOptions has the right
properties.
author: Zibi Braniecki
includes: [testIntl.js]
includes: [testIntl.js, propertyHelper.js]
---*/
var actual = new Intl.PluralRules().resolvedOptions();
@ -19,10 +19,10 @@ assert.notSameValue(actual2, actual, "resolvedOptions returned the same object t
// this assumes the default values where the specification provides them
mustHaveProperty(actual, "locale", isCanonicalizedStructurallyValidLanguageTag);
mustHaveProperty(actual, "type", ["cardinal"]);
mustNotHaveProperty(actual, "currency");
mustNotHaveProperty(actual, "currencyDisplay");
verifyProperty(actual, "currency", undefined);
verifyProperty(actual, "currencyDisplay", undefined);
mustHaveProperty(actual, "minimumIntegerDigits", [1]);
mustHaveProperty(actual, "minimumFractionDigits", [0]);
mustHaveProperty(actual, "maximumFractionDigits", [3]);
mustNotHaveProperty(actual, "minimumSignificantDigits");
mustNotHaveProperty(actual, "maximumSignificantDigits");
verifyProperty(actual, "minimumSignificantDigits", undefined);
verifyProperty(actual, "maximumSignificantDigits", undefined);