Repository navigation
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a randomized testing suite for the intl4x package to verify that specialized NumberFormat convenience constructors behave identically to the general constructor when provided with equivalent configurations. This approach helps ensure consistency across the API and proactively identifies edge cases or errors in formatting logic. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
PR HealthBreaking changes ✔️
This check can be disabled by tagging the PR with Coverage ✔️
This check for test coverage is informational (issues shown here will not fail the PR). This check can be disabled by tagging the PR with Changelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. This check can be disabled by tagging the PR with License Headers ✔️
All source files should start with a license header. This check can be disabled by tagging the PR with API leaks ✔️The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
This check can be disabled by tagging the PR with Unused Dependencies ✔️
For details on how to fix these, see dependency_validator. This check can be disabled by tagging the PR with |
There was a problem hiding this comment.
Code Review
This pull request introduces a new test file number_format_equivalence_test.dart to verify that the convenience constructors of NumberFormat (percent, compact, and currency) behave identically to the general NumberFormat constructor when configured with equivalent options. The reviewer suggests exporting NumberingSystem from package:intl4x/number_format.dart in a future change, as it is currently imported from datetime_format.dart but used in NumberFormat constructors.
|
|
||
| import 'dart:math'; | ||
|
|
||
| import 'package:intl4x/datetime_format.dart' show NumberingSystem; |
There was a problem hiding this comment.
It looks like NumberingSystem is imported from package:intl4x/datetime_format.dart because it is not currently exported by package:intl4x/number_format.dart. Since NumberFormat accepts NumberingSystem? numberingSystem in its constructors, NumberingSystem should ideally be exported by package:intl4x/number_format.dart to make the API more cohesive and discoverable for users. Consider exporting NumberingSystem in pkgs/intl4x/lib/number_format.dart in a follow-up change.
|
|
||
| import 'dart:math'; | ||
|
|
||
| import 'package:intl4x/datetime_format.dart' show NumberingSystem; |
Checks that NumberFormat.percent, NumberFormat.compact and NumberFormat.currency format exactly like the general NumberFormat constructor with the equivalent style or notation, for random option combinations with a fixed seed, and that no combination throws. It catches both the dropped digits in NumberFormat.percent and the currency fraction digits error fixed earlier in this stack.
7967728 to
5991ed8
Compare
Note
This PR was generated by an AI coding agent (Jetski) on behalf of @mosuem.
Adds
test/number_format_equivalence_test.dart. It checks thatNumberFormat.percent,NumberFormat.compactandNumberFormat.currencyformat exactly like the generalNumberFormatconstructor with the equivalent style or notation, for 300 random option combinations each, and that no combination throws.The random options cover every parameter of these constructors: locale, sign display, notation, grouping, numbering system, rounding mode, trailing zero display, minimum integer digits, fraction and significant digits (with rounding priority), currency display and sign, and the style for compact. The seed is fixed, so results are reproducible, and a failure lists the first failing combinations.
The test would have caught both bugs fixed earlier in this stack:
NumberFormat.percentfix ([intl4x] Fix NumberFormat.percent ignoring digits #1115), 149 of 300 combinations format differently.maximumFractionDigits value is out of range.Like the other tests for these constructors, it only runs on web (the group is tagged
icu4xUnimplemented), because they are not implemented on native yet.Verified locally:
dart analyze --fatal-infos,dart format --output=none --set-exit-if-changed .,dart test -p node -x ecmaUnsupported,dart test -p node -c dart2wasmon the number format tests, anddart teston the number format tests (VM, where the new tests are skipped) pass. The new tests take well under a second.