diff options
author | André Bargull <andre.bargull@gmail.com> | 2017-04-05 19:34:37 +0200 |
---|---|---|
committer | Leo Balter <leonardo.balter@gmail.com> | 2017-04-06 15:30:13 -0400 |
commit | 3291704eb2236de124dbed4065fe9af4d39e4d21 (patch) | |
tree | 98b8aa7a38a18ad8a84a167e204a767ae02b3b69 /test/intl402 | |
parent | ef7b99970b241befd8056e11dbdba67e10f531a8 (diff) | |
download | qtdeclarative-testsuites-3291704eb2236de124dbed4065fe9af4d39e4d21.tar.gz |
Fix multiple test errors
Tests doesn't use async functionality and don't call $DONE, so remove
"async" flag:
- src/params/error/async-gen-named-func-expr.template
- test/language/expressions/async-generator/params-named-dflt-abrupt.js
- test/language/expressions/async-generator/params-named-dflt-ref-later.js
- test/language/expressions/async-generator/params-named-dflt-ref-self.js
Intl.PluralRules.prototype is no longer a Intl.Prototype instance:
- test/intl402/PluralRules/prototype/prototype.js
Intl.PluralRules throws an error when called as a function:
- test/intl402/PluralRules/undefined-newtarget-throws.js
Module namespace objects call OrdinaryDelete for symbol properties:
- test/language/module-code/namespace/internals/delete-non-exported.js
Async generators no longer retrieves "done" property twice:
- src/async-generators/yield-star-async-next.case
- src/async-generators/yield-star-async-return.case
- src/async-generators/yield-star-async-throw.case
Minor units of CLF is 4, so we need to test with maximumFractionDigits=3
to get an error:
- test/intl402/NumberFormat/dft-currency-mnfd-range-check-mxfd.js
DateTimeFormat.prototype.formatToParts length property was changed from
0 to 1:
- test/intl402/DateTimeFormat/prototype/formatToParts/length.js
minimumSignificantDigits and maximumSignificantDigits properties are
only retrieved once:
- test/intl402/NumberFormat/11.1.1_32.js
Diffstat (limited to 'test/intl402')
6 files changed, 49 insertions, 58 deletions
diff --git a/test/intl402/DateTimeFormat/prototype/formatToParts/length.js b/test/intl402/DateTimeFormat/prototype/formatToParts/length.js index 49ceae3bc..948a7f892 100644 --- a/test/intl402/DateTimeFormat/prototype/formatToParts/length.js +++ b/test/intl402/DateTimeFormat/prototype/formatToParts/length.js @@ -6,7 +6,7 @@ description: Intl.DateTimeFormat.prototype.formatToParts.length. includes: [propertyHelper.js] ---*/ -assert.sameValue(Intl.DateTimeFormat.prototype.formatToParts.length, 0); +assert.sameValue(Intl.DateTimeFormat.prototype.formatToParts.length, 1); verifyNotEnumerable(Intl.DateTimeFormat.prototype.formatToParts, "length"); verifyNotWritable(Intl.DateTimeFormat.prototype.formatToParts, "length"); diff --git a/test/intl402/NumberFormat/11.1.1_32.js b/test/intl402/NumberFormat/11.1.1_32.js index fba78bb8f..cc45b009e 100644 --- a/test/intl402/NumberFormat/11.1.1_32.js +++ b/test/intl402/NumberFormat/11.1.1_32.js @@ -9,28 +9,23 @@ description: > author: Norbert Lindenberg ---*/ -var read = 0; +var minimumSignificantDigitsRead = false; +var maximumSignificantDigitsRead = false; function readMinimumSignificantDigits() { - ++read; - if (read === 1) { - return 0; // invalid value, but on first read that's OK - } else if (read === 3) { - return 1; // valid value - } else { - $ERROR("minimumSignificantDigits read out of sequence: " + read + "."); - } + assert.sameValue(minimumSignificantDigitsRead, false, + "minimumSignificantDigits getter already called"); + assert.sameValue(maximumSignificantDigitsRead, false, + "maximumSignificantDigits getter called before minimumSignificantDigits"); + minimumSignificantDigitsRead = true; + return 1; } function readMaximumSignificantDigits() { - ++read; - if (read === 2) { - return 0; // invalid value, but on first read that's OK - } else if (read === 4) { - return 1; // valid value - } else { - $ERROR("maximumSignificantDigits read out of sequence: " + read + "."); - } + assert.sameValue(maximumSignificantDigitsRead, false, + "maximumSignificantDigits getter already called"); + maximumSignificantDigitsRead = true; + return 1; } var options = {}; @@ -41,6 +36,5 @@ Object.defineProperty(options, "maximumSignificantDigits", new Intl.NumberFormat("de", options); -if (read !== 4) { - $ERROR("insuffient number of property reads: " + read + "."); -} +assert(minimumSignificantDigitsRead, "minimumSignificantDigits getter was called once"); +assert(maximumSignificantDigitsRead, "maximumSignificantDigits getter was called once"); diff --git a/test/intl402/NumberFormat/dft-currency-mnfd-range-check-mxfd.js b/test/intl402/NumberFormat/dft-currency-mnfd-range-check-mxfd.js index 6cefcb96d..00eed32e4 100644 --- a/test/intl402/NumberFormat/dft-currency-mnfd-range-check-mxfd.js +++ b/test/intl402/NumberFormat/dft-currency-mnfd-range-check-mxfd.js @@ -17,5 +17,5 @@ assert.throws(RangeError, () => new Intl.NumberFormat('en', { assert.throws(RangeError, () => new Intl.NumberFormat('en', { style: 'currency', currency: 'CLF', - maximumFractionDigits: 4 -}), 'CurrencyDigits(CLF) == 4'); + maximumFractionDigits: 3 +}), 'CurrencyDigits(CLF) == 3'); diff --git a/test/intl402/PluralRules/prototype/prototype.js b/test/intl402/PluralRules/prototype/prototype.js index c3b9bcae5..c42e80331 100644 --- a/test/intl402/PluralRules/prototype/prototype.js +++ b/test/intl402/PluralRules/prototype/prototype.js @@ -4,14 +4,13 @@ /*--- esid: sec-properties-of-intl-pluralrules-prototype-object description: > - Tests that Intl.PluralRules.prototype is an object that has been + Tests that Intl.PluralRules.prototype is not an object that has been initialized as an Intl.PluralRules. author: Zibi Braniecki ---*/ -// test by calling a function that would fail if "this" were not an object +// test by calling a function that fails if "this" is not an object // initialized as an Intl.PluralRules -if (typeof Intl.PluralRules.prototype.select(0) !== "string") { - $ERROR("Intl.PluralRules's prototype is not an object that has been " + - "initialized as an Intl.PluralRules"); -} +assert.throws(TypeError, function() { + Intl.PluralRules.prototype.select(0); +}, "Intl.PluralRules.prototype is not an object that has been initialized as an Intl.PluralRules"); diff --git a/test/intl402/PluralRules/this-not-ignored.js b/test/intl402/PluralRules/this-not-ignored.js deleted file mode 100644 index 922fcc51b..000000000 --- a/test/intl402/PluralRules/this-not-ignored.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2016 Mozilla Corporation. All rights reserved. -// This code is governed by the license found in the LICENSE file. - -/*--- -esid: sec-Intl.PluralRules -description: Tests that the this-value is ignored in PluralRules -author: Zibi Braniecki -includes: [testIntl.js] ----*/ - -testWithIntlConstructors(function (Constructor) { - var obj, newObj; - - // variant 1: use constructor in a "new" expression - obj = new Constructor(); - newObj = Intl.PluralRules.call(obj); - if (obj === newObj) { - $ERROR("PluralRules object created with \"new\" was not ignored as this-value."); - } - - // variant 2: use constructor as a function - obj = Constructor(); - newObj = Intl.PluralRules.call(obj); - if (obj === newObj) { - $ERROR("PluralRules object created with constructor as function was not ignored as this-value."); - } - - return true; -}); diff --git a/test/intl402/PluralRules/undefined-newtarget-throws.js b/test/intl402/PluralRules/undefined-newtarget-throws.js new file mode 100644 index 000000000..672f0c9e2 --- /dev/null +++ b/test/intl402/PluralRules/undefined-newtarget-throws.js @@ -0,0 +1,27 @@ +// Copyright 2016 Mozilla Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +esid: sec-Intl.PluralRules +description: Tests that PluralRules throws when called as a function +author: Zibi Braniecki +includes: [testIntl.js] +---*/ + +assert.throws(TypeError, function() { + Intl.PluralRules(); +}, "Intl.PluralRules throws when called as a function"); + +assert.throws(TypeError, function() { + Intl.PluralRules.call(undefined); +}, "Intl.PluralRules throws when called as a function with |undefined| as this-value"); + +testWithIntlConstructors(function (Constructor) { + var obj = new Constructor(); + + assert.throws(TypeError, function() { + Intl.PluralRules.call(obj) + }, "Intl.PluralRules throws when called as a function with an Intl-object as this-value"); + + return true; +}); |