diff --git a/test/intl402/PluralRules/internals.js b/test/intl402/PluralRules/internals.js index 1de97b3cdf..104428dfda 100644 --- a/test/intl402/PluralRules/internals.js +++ b/test/intl402/PluralRules/internals.js @@ -12,10 +12,6 @@ author: Zibi Braniecki var obj = new Intl.PluralRules(); var actualPrototype = Object.getPrototypeOf(obj); -if (actualPrototype !== Intl.PluralRules.prototype) { - $ERROR("Prototype of object constructed by Intl.PluralRules isn't Intl.PluralRules.prototype; got " + actualPrototype); -} +assert.sameValue(actualPrototype, Intl.PluralRules.prototype, "Prototype of object constructed by Intl.PluralRules isn't Intl.PluralRules.prototype; got " + actualPrototype); -if (!Object.isExtensible(obj)) { - $ERROR("Object constructed by Intl.PluralRules must be extensible."); -} +assert(Object.isExtensible(obj), "Object constructed by Intl.PluralRules must be extensible."); diff --git a/test/intl402/PluralRules/prototype/bind.js b/test/intl402/PluralRules/prototype/bind.js index fb07bd6e9f..7da84c681f 100644 --- a/test/intl402/PluralRules/prototype/bind.js +++ b/test/intl402/PluralRules/prototype/bind.js @@ -19,16 +19,8 @@ var invalidTargets = [undefined, null, true, 0, "PluralRules", [], {}]; Object.getOwnPropertyNames(functions).forEach(function (functionName) { var f = functions[functionName]; invalidTargets.forEach(function (target) { - var error; - try { + assert.throws(TypeError, function () { f.call(target); - } catch (e) { - error = e; - } - if (error === undefined) { - $ERROR("Calling " + functionName + " on " + target + " was not rejected."); - } else if (error.name !== "TypeError") { - $ERROR("Calling " + functionName + " on " + target + " was rejected with wrong error " + error.name + "."); - } + }, "Calling " + functionName + " on " + target + " was not rejected."); }); }); diff --git a/test/intl402/PluralRules/prototype/constructor/main.js b/test/intl402/PluralRules/prototype/constructor/main.js index b76316ebd9..fb8634d019 100644 --- a/test/intl402/PluralRules/prototype/constructor/main.js +++ b/test/intl402/PluralRules/prototype/constructor/main.js @@ -9,7 +9,4 @@ description: > author: Zibi Braniecki ---*/ -if (Intl.PluralRules.prototype.constructor !== Intl.PluralRules) { - $ERROR("Intl.PluralRules.prototype.constructor is not the same as " + - "Intl.PluralRules"); -} +assert.sameValue(Intl.PluralRules.prototype.constructor, Intl.PluralRules, "Intl.PluralRules.prototype.constructor is not the same as Intl.PluralRules"); diff --git a/test/intl402/PluralRules/prototype/properties.js b/test/intl402/PluralRules/prototype/properties.js index 7c05f838ee..56faeca8a3 100644 --- a/test/intl402/PluralRules/prototype/properties.js +++ b/test/intl402/PluralRules/prototype/properties.js @@ -8,15 +8,7 @@ author: Zibi Braniecki ---*/ var desc = Object.getOwnPropertyDescriptor(Intl.PluralRules, "prototype"); -if (desc === undefined) { - $ERROR("Intl.PluralRules.prototype is not defined."); -} -if (desc.writable) { - $ERROR("Intl.PluralRules.prototype must not be writable."); -} -if (desc.enumerable) { - $ERROR("Intl.PluralRules.prototype must not be enumerable."); -} -if (desc.configurable) { - $ERROR("Intl.PluralRules.prototype must not be configurable."); -} +assert.notSameValue(desc, undefined, "Intl.PluralRules.prototype is not defined."); +assert.sameValue(desc.writable, false, "Intl.PluralRules.prototype must not be writable."); +assert.sameValue(desc.enumerable, false, "Intl.PluralRules.prototype must not be enumerable."); +assert.sameValue(desc.configurable, false, "Intl.PluralRules.prototype must not be configurable."); diff --git a/test/intl402/PluralRules/prototype/resolvedOptions/properties.js b/test/intl402/PluralRules/prototype/resolvedOptions/properties.js index 05f7ea37a3..355a5ab8c0 100644 --- a/test/intl402/PluralRules/prototype/resolvedOptions/properties.js +++ b/test/intl402/PluralRules/prototype/resolvedOptions/properties.js @@ -14,9 +14,7 @@ includes: [testIntl.js] var actual = new Intl.PluralRules().resolvedOptions(); var actual2 = new Intl.PluralRules().resolvedOptions(); -if (actual2 === actual) { - $ERROR("resolvedOptions returned the same object twice."); -} +assert.notSameValue(actual2, actual, "resolvedOptions returned the same object twice."); // this assumes the default values where the specification provides them mustHaveProperty(actual, "locale", isCanonicalizedStructurallyValidLanguageTag); diff --git a/test/intl402/PluralRules/supportedLocalesOf/main.js b/test/intl402/PluralRules/supportedLocalesOf/main.js index f9888165c2..f7661aa31b 100644 --- a/test/intl402/PluralRules/supportedLocalesOf/main.js +++ b/test/intl402/PluralRules/supportedLocalesOf/main.js @@ -15,15 +15,9 @@ var requestedLocales = [defaultLocale, notSupported]; var supportedLocales; -if (!Intl.PluralRules.hasOwnProperty('supportedLocalesOf')) { - $ERROR("Intl.PluralRules doesn't have a supportedLocalesOf property."); -} +assert(Intl.PluralRules.hasOwnProperty('supportedLocalesOf'), "Intl.PluralRules doesn't have a supportedLocalesOf property."); supportedLocales = Intl.PluralRules.supportedLocalesOf(requestedLocales); -if (supportedLocales.length !== 1) { - $ERROR('The length of supported locales list is not 1.'); -} - -if (supportedLocales[0] !== defaultLocale) { - $ERROR('The default locale is not returned in the supported list.'); -} +assert.sameValue(supportedLocales.length, 1, 'The length of supported locales list is not 1.'); + +assert.sameValue(supportedLocales[0], defaultLocale, 'The default locale is not returned in the supported list.');