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

test(list): add characterization tests for list #167

Merged
merged 1 commit into from
May 9, 2023

Conversation

joshka
Copy link
Member

@joshka joshka commented May 6, 2023

  • also adds builder methods on list state to make it easy to construct
    a list state with selected and offset as a one-liner. Uses with_ as
    the prefix for these methods as the selected method currently acts as
    a getter rather than a builder.
  • cargo tarpaulin suggests only two lines are not covered (the two
    match patterns of the self.start_corner match 223 and 227).
    the body of these lines is covered, so this is probably 100%

Contextually, this PR is about putting in place some tests for the list widget so that we can easily refactor some of the complexity of the methods to be easy to read and maintain.

Note: this sits on #161 which is not yet merged, so ignore the changes to buffer / sparkline for now.

@sophacles
Copy link
Contributor

Would you mind rebasing against main now that #161 is merged? Nothing in here is objectionable, just not sure what's different from main now.

- also adds builder methods on list state to make it easy to construct
  a list state with selected and offset as a one-liner. Uses `with_` as
  the prefix for these methods as the selected method currently acts as
  a getter rather than a builder.
- cargo tarpaulin suggests only two lines are not covered (the two
  match patterns of the self.start_corner match 223 and 227).
  the body of these lines is covered, so this is probably 100% coverage.
@joshka
Copy link
Member Author

joshka commented May 9, 2023

Would you mind rebasing against main now that #161 is merged? Nothing in here is objectionable, just not sure what's different from main now.

Done

Copy link
Contributor

@sophacles sophacles left a comment

Choose a reason for hiding this comment

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

Yay tests!

Copy link
Member

@orhun orhun left a comment

Choose a reason for hiding this comment

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

LGTM!

@orhun orhun merged commit 548961f into ratatui:main May 9, 2023
@joshka joshka deleted the test-list branch May 9, 2023 21:22
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.

3 participants