ljharb / es-abstract

ECMAScript spec abstract operations.
MIT License
114 stars 30 forks source link

[Fix] `ES2021+`: values that truncate to -0 in `ToIntegerOrInfinity` #146

Closed ptomato closed 2 years ago

ptomato commented 2 years ago

ToIntegerOrInfinity(-0.1) should return 0, not -0.

This was also the case in ES2020's ToInteger (but not in earlier versions) so this adds a similar test to ES2020's tests as well, although no fix is needed there.

codecov[bot] commented 2 years ago

Codecov Report

Base: 95.10% // Head: 95.15% // Increases project coverage by +0.05% :tada:

Coverage data is based on head (7d6834a) compared to base (5ef984b). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #146 +/- ## ========================================== + Coverage 95.10% 95.15% +0.05% ========================================== Files 1362 1362 Lines 18829 18833 +4 Branches 4079 4081 +2 ========================================== + Hits 17907 17921 +14 + Misses 922 912 -10 ``` | [Impacted Files](https://codecov.io/gh/ljharb/es-abstract/pull/146?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jordan+Harband) | Coverage Δ | | |---|---|---| | [2021/ToIntegerOrInfinity.js](https://codecov.io/gh/ljharb/es-abstract/pull/146/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jordan+Harband#diff-MjAyMS9Ub0ludGVnZXJPckluZmluaXR5Lmpz) | `100.00% <100.00%> (ø)` | | | [2022/ToIntegerOrInfinity.js](https://codecov.io/gh/ljharb/es-abstract/pull/146/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jordan+Harband#diff-MjAyMi9Ub0ludGVnZXJPckluZmluaXR5Lmpz) | `100.00% <100.00%> (ø)` | | | [2020/CreateRegExpStringIterator.js](https://codecov.io/gh/ljharb/es-abstract/pull/146/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jordan+Harband#diff-MjAyMC9DcmVhdGVSZWdFeHBTdHJpbmdJdGVyYXRvci5qcw==) | `90.41% <0.00%> (+2.73%)` | :arrow_up: | | [2021/CreateRegExpStringIterator.js](https://codecov.io/gh/ljharb/es-abstract/pull/146/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jordan+Harband#diff-MjAyMS9DcmVhdGVSZWdFeHBTdHJpbmdJdGVyYXRvci5qcw==) | `90.41% <0.00%> (+2.73%)` | :arrow_up: | | [2022/CreateRegExpStringIterator.js](https://codecov.io/gh/ljharb/es-abstract/pull/146/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jordan+Harband#diff-MjAyMi9DcmVhdGVSZWdFeHBTdHJpbmdJdGVyYXRvci5qcw==) | `90.41% <0.00%> (+2.73%)` | :arrow_up: | | [helpers/assign.js](https://codecov.io/gh/ljharb/es-abstract/pull/146/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jordan+Harband#diff-aGVscGVycy9hc3NpZ24uanM=) | `100.00% <0.00%> (+40.00%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jordan+Harband). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jordan+Harband)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

ljharb commented 2 years ago

v1.20.4 released.