Skip to content

Add tests for era index #6518

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
merged 1 commit into from
May 2, 2025
Merged

Add tests for era index #6518

merged 1 commit into from
May 2, 2025

Conversation

sffc
Copy link
Member

@sffc sffc commented May 2, 2025

Shows us where we're at regarding #6444, so that if someone wants to fix it, they know what to fix.

@sffc sffc requested a review from a team May 2, 2025 01:13
@sffc sffc requested a review from Manishearth as a code owner May 2, 2025 01:13
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Hello @sffc, 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!

Summary of Changes

This pull request adds tests for era indices in the any_calendar.rs file. The goal is to show the current status regarding issue #6444 and provide a clear understanding of what needs to be fixed. The changes primarily involve modifying the test functions single_test_roundtrip and single_test_error to accept era information as a tuple of (&str, Option<u8>) instead of just &str. This allows for testing of both the era code and its index. The existing tests are then updated to use the new format for era information.

Highlights

  • Test Enhancement: The pull request enhances the existing tests to include era index validation, providing better coverage for calendar functionality.
  • Parameter Update: The single_test_roundtrip and single_test_error functions now accept a tuple for era information, allowing for testing of both era code and index.
  • Issue Tracking: This PR aims to provide a clear picture of the status of issue Formatting era index is really bad and will break in CLDR 48 #6444, making it easier for contributors to address the remaining problems.

Changelog

  • components/calendar/src/any_calendar.rs
    • Modified single_test_roundtrip function to accept era as Option<(&str, Option<u8>)>.
    • Modified single_test_error function to accept era as Option<(&str, Option<u8>)>.
    • Added era roundtrip assertion to single_test_roundtrip to validate era code and index.
    • Updated existing tests to use the new era tuple format, including Buddhist, Coptic, Ethiopian, EthioAA, Gregorian, Indian, Japanese, JapanExt, Persian, Hebrew, ROC, and Hijri calendars.
Using Gemini Code Assist

The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize 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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


In calendar's embrace,
Eras dance through time and space,
A test ensures all,
No dates will fall,
In temporal disgrace.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request introduces tests for era indices in the calendar components. The changes look good overall, but there are a few areas that could be improved for clarity and consistency.

Summary of Findings

  • Clarity of test parameters: The single_test_roundtrip and single_test_error functions now accept a tuple for the era parameter, which includes both the era code and an optional era index. While this change is functional, it might be beneficial to clarify the purpose of the optional era index in the function documentation or comments.
  • Consistency in test cases: The test cases have been updated to include era indices. Ensure that all relevant test cases are updated consistently to reflect the new parameter structure.

Merge Readiness

The pull request is almost ready for merging. Addressing the clarity of test parameters would improve the overall quality of the code. I am unable to directly approve this pull request, and recommend that others review and approve this code before merging. At a minimum, the medium severity issues should be addressed before merging.

@sffc
Copy link
Member Author

sffc commented May 2, 2025

  • Clarity of test parameters: The single_test_roundtrip and single_test_error functions now accept a tuple for the era parameter, which includes both the era code and an optional era index. While this change is functional, it might be beneficial to clarify the purpose of the optional era index in the function documentation or comments.

This function already had no documentation. We should add documentation for it, but I don't want to hold up this PR on that, since the PR is still a net improvement.

  • Consistency in test cases: The test cases have been updated to include era indices. Ensure that all relevant test cases are updated consistently to reflect the new parameter structure.

The build should fail if anything hasn't been updated.

@sffc sffc merged commit 04a64b6 into unicode-org:main May 2, 2025
29 checks passed
@sffc sffc deleted the test-era-index branch May 2, 2025 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants