diff --git a/test/intl402/Collator/10.1.1_1.js b/test/intl402/Collator/10.1.1_1.js index 42f4fe67b64e831d7840a221c937f852bac43a1b..faab9aceecb60f82cee5d40e7c4a25566e821aca 100644 --- a/test/intl402/Collator/10.1.1_1.js +++ b/test/intl402/Collator/10.1.1_1.js @@ -14,16 +14,12 @@ testWithIntlConstructors(function (Constructor) { // variant 1: use constructor in a "new" expression obj = new Constructor(); newObj = Intl.Collator.call(obj); - if (obj === newObj) { - $ERROR("Collator object created with \"new\" was not ignored as this-value."); - } + assert.notSameValue(obj, newObj, "Collator object created with \"new\" was not ignored as this-value."); // variant 2: use constructor as a function obj = Constructor(); newObj = Intl.Collator.call(obj); - if (obj === newObj) { - $ERROR("Collator object created with constructor as function was not ignored as this-value."); - } + assert.notSameValue(obj, newObj, "Collator object created with constructor as function was not ignored as this-value."); return true; }); diff --git a/test/intl402/Collator/10.1.1_10.js b/test/intl402/Collator/10.1.1_10.js index b5e0d6d19e9a9a0f3e45b79ed43d33e196bd997b..526552a76a54c925fe0e3739cb75577d222a8bd1 100644 --- a/test/intl402/Collator/10.1.1_10.js +++ b/test/intl402/Collator/10.1.1_10.js @@ -13,6 +13,4 @@ includes: [testIntl.js] taintProperties(["localeMatcher", "kn", "kf"]); var locale = new Intl.Collator(undefined, {localeMatcher: "lookup"}).resolvedOptions().locale; -if (!isCanonicalizedStructurallyValidLanguageTag(locale)) { - $ERROR("Collator returns invalid locale " + locale + "."); -} +assert(isCanonicalizedStructurallyValidLanguageTag(locale), "Collator returns invalid locale " + locale + "."); diff --git a/test/intl402/Collator/10.1.1_19_b.js b/test/intl402/Collator/10.1.1_19_b.js index 47642dc1f6dcfe9587802e2db6e1505562d33fb6..8a6eaeb3579e1ed750bd3204e3bf9cbc9ae72e20 100644 --- a/test/intl402/Collator/10.1.1_19_b.js +++ b/test/intl402/Collator/10.1.1_19_b.js @@ -13,16 +13,10 @@ function checkCollation(extensionCoValue, usageValue, expectedCollations, expect var collator = new Intl.Collator([requestLocale], options); var collation = collator.resolvedOptions().collation; - if (expectedCollations.indexOf(collation) === -1) { - $ERROR((extensionCoValue === undefined ? "Default collation" : "Collation for \"" + extensionCoValue) + - "\" should be " + expectedCollations.join(" or ") + ", but is " + collation + "."); - } + assert.notSameValue(expectedCollations.indexOf(collation), -1, (extensionCoValue === undefined ? "Default collation" : "Collation for \"" + extensionCoValue) + "\" should be " + expectedCollations.join(" or ") + ", but is " + collation + "."); var usage = collator.resolvedOptions().usage; - if (expectedUsage !== usage) { - $ERROR((usageValue === undefined ? "Default usage" : "Usage") + - " should be " + expectedUsage + ", but is " + usage + "."); - } + assert.sameValue(usage, expectedUsage, (usageValue === undefined ? "Default usage" : "Usage") + " mismatch."); } checkCollation(undefined, undefined, ["default"], "sort"); diff --git a/test/intl402/Collator/10.1.1_19_c.js b/test/intl402/Collator/10.1.1_19_c.js index 7a4239e016cbe5d2c9c96080461d0d2896571761..ae4f099fb1ec249568b1a64550421728aae5d512 100644 --- a/test/intl402/Collator/10.1.1_19_c.js +++ b/test/intl402/Collator/10.1.1_19_c.js @@ -35,10 +35,7 @@ options.forEach(function (option) { supportedValues.forEach(function (value) { collator = new Intl.Collator([defaultLocale + "-u-" + option.key + "-" + value]); result = collator.resolvedOptions()[option.property]; - if (result !== value) { - $ERROR("Property " + option.property + " couldn't be set through locale extension key " + - option.key + "; requested value: " + value + "; actual value: " + result + "."); - } + assert.sameValue(result, value, "Property " + option.property + " couldn't be set through locale extension key " + option.key + "."); }); // verify that the options setting overrides the locale setting @@ -54,10 +51,7 @@ options.forEach(function (option) { opt[option.property] = value; collator = new Intl.Collator([defaultLocale + "-u-" + option.key + "-" + otherValue], opt); result = collator.resolvedOptions()[option.property]; - if (result !== value) { - $ERROR("Options value for property " + option.property + " doesn't override locale extension key " + - option.key + "; requested value: " + value + "; actual value: " + result + "."); - } + assert.sameValue(result, value, "Options value for property " + option.property + " doesn't override locale extension key " + option.key + "."); } }); }); diff --git a/test/intl402/Collator/10.1.3.js b/test/intl402/Collator/10.1.3.js index 942fdf3ec73cbea90781ffd40f29bac8b9edf25f..47263a1b67e03727ebd97c26e8a71fee899da7aa 100644 --- a/test/intl402/Collator/10.1.3.js +++ b/test/intl402/Collator/10.1.3.js @@ -12,10 +12,6 @@ author: Norbert Lindenberg var obj = new Intl.Collator(); var actualPrototype = Object.getPrototypeOf(obj); -if (actualPrototype !== Intl.Collator.prototype) { - $ERROR("Prototype of object constructed by Intl.Collator isn't Intl.Collator.prototype; got " + actualPrototype); -} +assert.sameValue(actualPrototype, Intl.Collator.prototype, "Prototype of object constructed by Intl.Collator isn't Intl.Collator.prototype."); -if (!Object.isExtensible(obj)) { - $ERROR("Object constructed by Intl.Collator must be extensible."); -} +assert(Object.isExtensible(obj), "Object constructed by Intl.Collator must be extensible."); diff --git a/test/intl402/Collator/10.2.3_b.js b/test/intl402/Collator/10.2.3_b.js index c7ae39850b03b0825c5cf8dff3432816ed4b06a4..7add01d5b026fa1e2afac83ede8282a1f3132797 100644 --- a/test/intl402/Collator/10.2.3_b.js +++ b/test/intl402/Collator/10.2.3_b.js @@ -39,14 +39,8 @@ Object.getOwnPropertyNames(keyValues).forEach(function (key) { keyValues[key].forEach(function (value) { var collator = new Intl.Collator([defaultLocale + "-u-" + key + "-" + value]); var options = collator.resolvedOptions(); - if (options.locale !== defaultLocale) { - $ERROR("Locale " + options.locale + " is affected by key " + - key + "; value " + value + "."); - } - if (JSON.stringify(options) !== defaultOptionsJSON) { - $ERROR("Resolved options " + JSON.stringify(options) + " are affected by key " + - key + "; value " + value + "."); - } + assert.sameValue(options.locale, defaultLocale, "Locale " + options.locale + " is affected by key " + key + "; value " + value + "."); + assert.sameValue(JSON.stringify(options), defaultOptionsJSON, "Resolved options " + JSON.stringify(options) + " are affected by key " + key + "; value " + value + "."); testArraysAreSame(defaultSortedArray, testArray.sort(collator.compare)); }); }); diff --git a/test/intl402/Collator/10.4_a.js b/test/intl402/Collator/10.4_a.js index 3b250759ad727f81d8fda90a87f355e6d149b5af..37b975130492e5707d689187141ec040c36466c0 100644 --- a/test/intl402/Collator/10.4_a.js +++ b/test/intl402/Collator/10.4_a.js @@ -10,6 +10,4 @@ author: Norbert Lindenberg var obj = new Intl.Collator(); var toStringValue = Object.prototype.toString.call(obj); -if (toStringValue !== "[object Object]") { - $ERROR("Intl.Collator instance produces wrong [[Class]] - toString returns " + toStringValue + "."); -} +assert.sameValue(toStringValue, "[object Object]", "Intl.Collator instance produces wrong [[Class]] - toString returns " + toStringValue + "."); diff --git a/test/intl402/Collator/9.2.5_11_g_ii_2.js b/test/intl402/Collator/9.2.5_11_g_ii_2.js index f7af9512c0e05e151f5e1777926e39fa938025d8..44642492b4c4d652f62adaaea4de6636ebeccfda 100644 --- a/test/intl402/Collator/9.2.5_11_g_ii_2.js +++ b/test/intl402/Collator/9.2.5_11_g_ii_2.js @@ -17,11 +17,7 @@ extensions.forEach(function (extension) { var locale = collator.resolvedOptions().locale; var numeric = collator.resolvedOptions().numeric; if (numeric !== undefined) { - if (numeric !== true) { - $ERROR("Default value for \"kn\" should be true, but is " + numeric + "."); - } - if (locale.indexOf("-kn") !== -1) { - $ERROR("\"kn\" is returned in locale, but shouldn't be."); - } + assert.sameValue(numeric, true, "Default value for \"kn\" should be true, but is " + numeric + "."); + assert.sameValue(locale.indexOf("-kn"), -1, "\"kn\" is returned in locale, but shouldn't be."); } }); diff --git a/test/intl402/Collator/prototype/10.2.1.js b/test/intl402/Collator/prototype/10.2.1.js index c47db09db60779527315b330a07249729b077c49..879362e449439813d5c4f22a28199bfc730de8b3 100644 --- a/test/intl402/Collator/prototype/10.2.1.js +++ b/test/intl402/Collator/prototype/10.2.1.js @@ -8,15 +8,7 @@ author: Norbert Lindenberg ---*/ var desc = Object.getOwnPropertyDescriptor(Intl.Collator, "prototype"); -if (desc === undefined) { - $ERROR("Intl.Collator.prototype is not defined."); -} -if (desc.writable) { - $ERROR("Intl.Collator.prototype must not be writable."); -} -if (desc.enumerable) { - $ERROR("Intl.Collator.prototype must not be enumerable."); -} -if (desc.configurable) { - $ERROR("Intl.Collator.prototype must not be configurable."); -} +assert.notSameValue(desc, undefined, "Intl.Collator.prototype is not defined."); +assert.sameValue(desc.writable, false, "Intl.Collator.prototype must not be writable."); +assert.sameValue(desc.enumerable, false, "Intl.Collator.prototype must not be enumerable."); +assert.sameValue(desc.configurable, false, "Intl.Collator.prototype must not be configurable."); diff --git a/test/intl402/Collator/prototype/10.3_a.js b/test/intl402/Collator/prototype/10.3_a.js index a155b8c949d118ebdd75e51c2384a6b3376eaf84..9fb489ab4f32bf33b100349fb65c156759a0ba6f 100644 --- a/test/intl402/Collator/prototype/10.3_a.js +++ b/test/intl402/Collator/prototype/10.3_a.js @@ -10,7 +10,4 @@ description: > // test by calling a function that would fail if "this" were not an object // initialized as an Intl.Collator -if (Intl.Collator.prototype.compare("aаã‚ì•„", "aаã‚ì•„") !== 0) { - $ERROR("Intl.Collator.prototype is not an object that has been " + - "initialized as an Intl.Collator."); -} +assert.sameValue(Intl.Collator.prototype.compare("aаã‚ì•„", "aаã‚ì•„"), 0, "Intl.Collator.prototype is not an object that has been initialized as an Intl.Collator."); diff --git a/test/intl402/Collator/prototype/10.3_b.js b/test/intl402/Collator/prototype/10.3_b.js index 312cd3fcdd86d7b711e3bea68feade76c15547a4..ea3f62c3157982d8f66339a02a007d99e01a09d7 100644 --- a/test/intl402/Collator/prototype/10.3_b.js +++ b/test/intl402/Collator/prototype/10.3_b.js @@ -19,16 +19,8 @@ var invalidTargets = [undefined, null, true, 0, "Collator", [], {}]; 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/Collator/prototype/compare/10.3.2_CS_a.js b/test/intl402/Collator/prototype/compare/10.3.2_CS_a.js index 630c3e48c65e324523853884f26be5684bad3f08..164b6aff5cc9d47f06341c628db80d23f6c2fea7 100644 --- a/test/intl402/Collator/prototype/compare/10.3.2_CS_a.js +++ b/test/intl402/Collator/prototype/compare/10.3.2_CS_a.js @@ -52,10 +52,7 @@ var pairs = [ var i; for (i = 0; i < pairs.length; i++) { var pair = pairs[i]; - if (collator.compare(pair[0], pair[1]) !== 0) { - $ERROR("Collator.compare considers " + pair[0] + " (" + toU(pair[0]) + - ") ≠" + pair[1] + " (" + toU(pair[1]) + ")."); - } + assert.sameValue(collator.compare(pair[0], pair[1]), 0, "Collator.compare considers " + pair[0] + " (" + toU(pair[0]) + ") ≠" + pair[1] + " (" + toU(pair[1]) + ")."); } function toU(s) { diff --git a/test/intl402/Collator/prototype/constructor/10.3.1.js b/test/intl402/Collator/prototype/constructor/10.3.1.js index 6a582b362f042ffe904a81e5c32ac851160456be..b700edba01de5b6b865f590a6903761fc1dc36f4 100644 --- a/test/intl402/Collator/prototype/constructor/10.3.1.js +++ b/test/intl402/Collator/prototype/constructor/10.3.1.js @@ -8,7 +8,4 @@ description: > Intl.Collator. ---*/ -if (Intl.Collator.prototype.constructor !== Intl.Collator) { - $ERROR("Intl.Collator.prototype.constructor is not the same as " + - "Intl.Collator"); -} +assert.sameValue(Intl.Collator.prototype.constructor, Intl.Collator, "Intl.Collator.prototype.constructor is not the same as Intl.Collator"); diff --git a/test/intl402/Collator/prototype/resolvedOptions/10.3.3.js b/test/intl402/Collator/prototype/resolvedOptions/10.3.3.js index c50817283926e3d4b15a6365211a22d8e9124f5c..07a975d1cca87b672d3561e97ede4d8b3fa1633a 100644 --- a/test/intl402/Collator/prototype/resolvedOptions/10.3.3.js +++ b/test/intl402/Collator/prototype/resolvedOptions/10.3.3.js @@ -13,9 +13,7 @@ includes: [testIntl.js] var actual = new Intl.Collator().resolvedOptions(); var actual2 = new Intl.Collator().resolvedOptions(); -if (actual2 === actual) { - $ERROR("resolvedOptions returned the same object twice."); -} +assert.notSameValue(actual2, actual, "resolvedOptions returned the same object twice."); // source: CLDR file common/bcp47/collation.xml; version CLDR 21. var collations = [ diff --git a/test/intl402/Collator/supportedLocalesOf/10.2.2_a.js b/test/intl402/Collator/supportedLocalesOf/10.2.2_a.js index dcd56dc50c0959945cfd825a8679b76cd93e99c2..b7dc8219fcfe56df60ef2f34d9b2471a93a08577 100644 --- a/test/intl402/Collator/supportedLocalesOf/10.2.2_a.js +++ b/test/intl402/Collator/supportedLocalesOf/10.2.2_a.js @@ -14,15 +14,9 @@ var requestedLocales = [defaultLocale, notSupported]; var supportedLocales; -if (!Intl.Collator.hasOwnProperty('supportedLocalesOf')) { - $ERROR("Intl.Collator doesn't have a supportedLocalesOf property."); -} +assert(Intl.Collator.hasOwnProperty('supportedLocalesOf'), "Intl.Collator doesn't have a supportedLocalesOf property."); supportedLocales = Intl.Collator.supportedLocalesOf(requestedLocales); -if (supportedLocales.length !== 1) { - $ERROR('The length of supported locales list is not 1.'); -} +assert.sameValue(supportedLocales.length, 1, '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[0], defaultLocale, 'The default locale is not returned in the supported list.');