Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Implement String.prototype.toLocaleUpper/LowerCase #2822

Closed
wants to merge 3 commits into from

Conversation

jedel1043
Copy link
Member

This fixes some more ES5 tests that were failing because the functions haven't been implemented.

It changes the following:

  • Adds String::to_locale_case, which uses ICU4X to convert strings to uppercase or lowercase.
  • Refactors String::to_uppercase and String::to_lowercase into a single String::to_case which uses a const generic to distinguish each case.
  • Adds utility functions on JsString to avoid code repetition.

@jedel1043 jedel1043 added builtins PRs and Issues related to builtins/intrinsics API labels Apr 14, 2023
@jedel1043 jedel1043 added this to the v0.17.0 milestone Apr 14, 2023
@github-actions
Copy link

github-actions bot commented Apr 14, 2023

Test262 conformance changes

Test result main count PR count difference
Total 94,781 94,781 0
Passed 71,519 71,627 +108
Ignored 17,824 17,824 0
Failed 5,438 5,330 -108
Panics 0 0 0
Conformance 75.46% 75.57% +0.11%
Fixed tests (108):
test/intl402/String/prototype/toLocaleLowerCase/capital_I_with_dot.js [strict mode] (previously Failed)
test/intl402/String/prototype/toLocaleLowerCase/capital_I_with_dot.js (previously Failed)
test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-79.js [strict mode] (previously Failed)
test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-79.js (previously Failed)
test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-80.js [strict mode] (previously Failed)
test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-80.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A2_T1.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A2_T1.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/supplementary_plane.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/supplementary_plane.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/this-value-not-obj-coercible.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/this-value-not-obj-coercible.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A9.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A9.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T10.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T10.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T3.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T3.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T9.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T9.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T6.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T6.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T8.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T8.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T1.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T1.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T13.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T13.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T12.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T12.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T5.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T5.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T11.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T11.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/Final_Sigma_U180E.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/Final_Sigma_U180E.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/name.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/name.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A10.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A10.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/not-a-constructor.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/not-a-constructor.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T2.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T2.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A6.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A6.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T4.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T4.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/special_casing.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/special_casing.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A8.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A8.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T14.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T14.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/special_casing_conditional.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/special_casing_conditional.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A11.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A11.js (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T7.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T7.js (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A10.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A10.js (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T2.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T2.js (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/supplementary_plane.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/supplementary_plane.js (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/this-value-not-obj-coercible.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/this-value-not-obj-coercible.js (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T7.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T7.js (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T12.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T12.js (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T8.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T8.js (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T3.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T3.js (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A2_T1.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A2_T1.js (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T4.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T4.js (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T11.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T11.js (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T9.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T9.js (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T6.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T6.js (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A8.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A8.js (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/name.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/name.js (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/not-a-constructor.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/not-a-constructor.js (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A11.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A11.js (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T5.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T5.js (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T14.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T14.js (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A9.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A9.js (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T1.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T1.js (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T10.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T10.js (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A6.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A6.js (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T13.js [strict mode] (previously Failed)
test/built-ins/String/prototype/toLocaleUpperCase/S15.5.4.19_A1_T13.js (previously Failed)

@codecov
Copy link

codecov bot commented Apr 14, 2023

Codecov Report

Merging #2822 (1a9c79c) into main (236012d) will decrease coverage by 0.03%.
The diff coverage is 6.06%.

@@            Coverage Diff             @@
##             main    #2822      +/-   ##
==========================================
- Coverage   51.32%   51.29%   -0.03%     
==========================================
  Files         417      417              
  Lines       41356    41383      +27     
==========================================
+ Hits        21224    21226       +2     
- Misses      20132    20157      +25     
Impacted Files Coverage Δ
boa_engine/src/string/mod.rs 74.44% <0.00%> (-7.22%) ⬇️
boa_engine/src/builtins/string/mod.rs 58.02% <10.52%> (+0.26%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@raskad raskad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. When the function name is fixed, almost all tests in the String suite pass.

boa_engine/src/builtins/string/mod.rs Outdated Show resolved Hide resolved
@jedel1043 jedel1043 requested a review from raskad April 15, 2023 00:00
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way that we can avoid putting large binary data into git history? maybe generating this in a build.rs?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We started with the build.rs approach on this, but it did increase compile times to much, especially in the ci. I think for now this should work. Alternativeley, we could move boa_icu_provider to a separate repository to make this easier on the git history.

Also, before looking at the size of this file, I think we should probably look at the 262 test result files on the gh-pages branch :D

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We started with the build.rs approach on this, but it did increase compile times to much, especially in the ci. I think for now this should work. Alternativeley, we could move boa_icu_provider to a separate repository to make this easier on the git history.

Yes, for the long term this seems like the a good solution.

Also, before looking at the size of this file, I think we should probably look at the 262 test result files on the gh-pages branch :D

😆 Yeah, It's big, but we could always edit the history on the gh-pages tho

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jedel1043
Copy link
Member Author

bors r+

bors bot pushed a commit that referenced this pull request Apr 15, 2023
This fixes some more ES5 tests that were failing because the functions haven't been implemented.

It changes the following:

- Adds `String::to_locale_case`, which uses ICU4X to convert strings to uppercase or lowercase.
- Refactors `String::to_uppercase` and `String::to_lowercase` into a single `String::to_case` which uses a const generic to distinguish each case.
- Adds utility functions on `JsString` to avoid code repetition.
@bors
Copy link

bors bot commented Apr 15, 2023

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Implement String.prototype.toLocaleUpper/LowerCase [Merged by Bors] - Implement String.prototype.toLocaleUpper/LowerCase Apr 15, 2023
@bors bors bot closed this Apr 15, 2023
@bors bors bot deleted the to-locale-case branch April 15, 2023 03:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API builtins PRs and Issues related to builtins/intrinsics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants