Commit Graph

30 Commits

Author SHA1 Message Date
José Julián Espina 4a6439e4a7
Add `Array.prototype.includes` and `exponentiation` features (#3799) 2023-03-23 10:51:08 +01:00
Philip Chimento d87a7da6e1 Replace Object.hasOwnProperty.call with Object.prototype.hasOwnProperty.call
While we're at it, use assert() instead of assert.sameValue() for brevity,
if we are not specifically testing that the return value of hasOwnProperty
is the value true or false; and add more informative assertion messages to
help with debugging.

In some cases, the Object.hasOwnProperty.call could be replaced with
verifyProperty(), if the property descriptor was also being verified at
the same time.

This fixes some tests that were faulty to begin with: a common mistake was
Object.hasOwnProperty(obj, prop) which is probably going to return false
when that's not what you want.

The only instances left of `Object.hasOwnProperty` are one regression test
in implementation-contributed which I can't tell if it was intentionally
needed to trigger the regression, and a few instances of
`Object.hasOwnProperty('prototype')` which would defeat the purpose to
convert into `Object.prototype.hasOwnProperty.call(Object, 'prototype')`
form.

Closes: #3524
2022-11-30 16:04:02 -08:00
Frank Yung-Fong Tang 9997a26c7d
Fix tests on {localeMatcher: "lookup"} (#3008)
* Fix test for only {localeMatcher: "lookup"}

The expectation that "sr-Thai-RS" would be returned is only true with the 
9.2.2 BestAvailableLocale ( availableLocales, locale )
https://tc39.es/ecma402/#sec-bestavailablelocale
algorithm used by 9.2.3 LookupMatcher ( availableLocales, requestedLocales )
https://tc39.es/ecma402/#sec-lookupmatcher

The default for localeMatcher is "best fit" but not "lookup" for all Intl objects.

And for 9.2.4 BestFitMatcher ( availableLocales, requestedLocales )
https://tc39.es/ecma402/#sec-bestfitmatcher
It may not match "sr-Thai-RS" for "sr"  and return ["de", "zh-CN"] instead. Therefore, we need to change this test to only test on {localeMatcher: "lookup"}

* Add option to getLocaleSupportInfo

Needed to test different localeMatcher

* only test for "lookup" localeMatcher

* Get the info based on the localeMatcher

* pass in localeMatcher to getLocaleSupportInfo
2021-06-24 13:37:33 -04:00
Frank Yung-Fong Tang 31126581e7
Change Intl.(ListFormat|DisplayNames|Segmenter) (#2952)
* Change Intl.(ListFormat|DisplayNames|Segmenter)

Sync from ToObject to GetOptionsObject which throw TypeError
while the option is not object

* Add null and false to test
2021-03-08 19:31:26 -08:00
Yusuke Suzuki e75ed15b91 Perl YAML parser cannot parse documents in options-granularity-abrupt-throws.js and options-granularity-toString-abrupt-throws.js
Remove line terminator.
2020-09-21 16:04:44 -04:00
Rick Waldron cce13c4c24 Update test/intl402/Segmenter/constructor/constructor/options-localeMatcher-toString-abrupt-throws.js
Co-authored-by: Ujjwal Sharma <ryzokuken@disroot.org>
2020-09-10 16:08:39 -04:00
Rick Waldron 74bed11865 Update test/intl402/Segmenter/constructor/constructor/options-granularity-toString-abrupt-throws.js
Co-authored-by: Ujjwal Sharma <ryzokuken@disroot.org>
2020-09-10 16:08:39 -04:00
Frank Tang 7a4a637574 Address review comments 2020-09-10 16:08:39 -04:00
Frank Tang 6d97fa208a Fix errors 2020-09-10 16:08:39 -04:00
Frank Tang 085cb50b25 Add more tests for Intl.Segmenter 2020-09-10 16:08:39 -04:00
Alexey Shvayka 34cbf0aed2 Add "proto-from-ctor-realm" tests for Intl proposals (#2346)
* Add Intl.Segmenter test

* Add Intl.RelativeTimeFormat test

* Add Intl.Locale test

* Add Intl.ListFormat test
2019-10-08 14:39:52 -04:00
Mike Pennisi f26c2a11bd Remove unnecessary "includes" directives
The values defined by the referenced files are not used by these tests.
This makes their inclusion superfluous, which needlessly increases the
time to execute the tests and may confuse some readers.
2019-09-25 13:59:24 -04:00
André Bargull f7e8dba39b Update tests to parse language tags as Unicode BCP 47 Locale Identifiers
harness/testIntl.js
- Add now invalid tags to getInvalidLanguageTags, these tags were previously used in test files changed in this commit.
- Update isCanonicalizedStructurallyValidLanguageTag regular expressions.

test/intl402/Intl/getCanonicalLocales/canonicalized-tags.js
- Moved five now invalid tags to getInvalidLanguageTags function in testIntl.js

test/intl402/Intl/getCanonicalLocales/preferred-grandfathered.js
- All irregular grandfathered tags are invalid now
- Regular grandfathered with extlang subtags are now also invalid
- Regular grandfathered with variant-like subtags are still valid

test/intl402/Intl/getCanonicalLocales/weird-cases.js
- Revert changes from last commit
- "x-u-foo" is now invalid and was moved to getInvalidLanguageTags function

test/intl402/ListFormat/constructor/constructor/locales-valid.js
test/intl402/RelativeTimeFormat/constructor/constructor/locales-valid.js
test/intl402/Segmenter/constructor/constructor/locales-valid.js
- Irregular grandfathered and privateuse only are no longer valid language tags

test/intl402/language-tags-canonicalized.js
- Same changes as in test/intl402/Intl/getCanonicalLocales/canonicalized-tags.js

test/intl402/language-tags-invalid.js
- Invalid tags list in this file was a subset of getInvalidLanguageTags, so replaced with getInvalidLanguageTags to get more coverage

test/intl402/language-tags-valid.js
- Same changes as in test/intl402/Intl/getCanonicalLocales/canonicalized-tags.js
2019-07-21 05:44:21 -07:00
Timothy Gu e39604fa41 Fix missing ) (#2059) 2019-01-31 10:49:27 -07:00
Frank Yung-Fong Tang c390306921 add check for "line" throws RangeError 2019-01-30 10:08:50 -05:00
Frank Yung-Fong Tang 619f7cdad1 fix line number 2019-01-30 10:08:50 -05:00
Frank Yung-Fong Tang 806dc970c0 fix line number 2019-01-30 10:08:50 -05:00
Frank Yung-Fong Tang 12a044b1d8 fix line number 2019-01-30 10:08:50 -05:00
Frank Yung-Fong Tang 39b561c60c fix line number 2019-01-30 10:08:50 -05:00
Frank Tang 0460c52013 Remove "line" tests and ensure error under "line" 2019-01-30 10:08:50 -05:00
Frank Yung-Fong Tang 4f1155c566 Change tests according to ecma402/pull/278 (#2031) 2019-01-18 14:15:37 -02:00
Leo Balter e403eea331 Fix false positives 2018-12-21 10:50:23 -05:00
Leo Balter 46c557247e Fix more false positives throwing TypeError in functions 2018-12-17 16:45:56 -05:00
Rick Waldron 3b09d0e2b5 Eliminate false positives: Intl.* 2018-11-30 11:47:57 -05:00
Ms2ger 1185b5287d Intl.Segmenter: Submit remaining V8 tests. 2018-11-26 15:04:19 -05:00
Ms2ger ba6a483c43 Intl.Segmenter: Fix copy/paste errors in tests for valid options. 2018-11-15 10:04:28 -05:00
Ms2ger e1be2c8f8b Intl.Segmenter: Add some tests for the constructor. 2018-10-24 10:13:31 -04:00
Rick Waldron f247a5fe09 Revert "Improve assertion handling when comparison causes failure via coercion"
This reverts commit c49c356744.
2018-10-23 17:21:17 -04:00
Rick Waldron c49c356744 Improve assertion handling when comparison causes failure via coercion 2018-10-23 17:00:47 -04:00
Ms2ger e527498bff Intl.Segmenter: Some initial tests. (#1844) 2018-10-15 11:29:25 -04:00