这是indexloc提供的服务,不要输入任何密码
Skip to content

chore(tui): add test for key handling #9558

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
Dec 4, 2024
Merged

Conversation

chris-olszewski
Copy link
Member

Description

Before I realized that #9543 already fixed #9553 I started working on a unit test for this section of the code. Putting it up just so writing future tests should be easier.

Testing Instructions

Unit test runs and passes.

@chris-olszewski chris-olszewski marked this pull request as ready for review December 4, 2024 14:22
@chris-olszewski chris-olszewski requested a review from a team as a code owner December 4, 2024 14:22
Copy link

vercel bot commented Dec 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 4, 2024 2:22pm
8 Skipped Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Dec 4, 2024 2:22pm
examples-designsystem-docs ⬜️ Ignored (Inspect) Dec 4, 2024 2:22pm
examples-gatsby-web ⬜️ Ignored (Inspect) Dec 4, 2024 2:22pm
examples-kitchensink-blog ⬜️ Ignored (Inspect) Dec 4, 2024 2:22pm
examples-native-web ⬜️ Ignored (Inspect) Dec 4, 2024 2:22pm
examples-svelte-web ⬜️ Ignored (Inspect) Dec 4, 2024 2:22pm
examples-tailwind-web ⬜️ Ignored (Inspect) Dec 4, 2024 2:22pm
examples-vite-web ⬜️ Ignored (Inspect) Dec 4, 2024 2:22pm

) {
match (translate_key_event(opts, key_event), expected) {
(Some(actual), Some(expected)) => {
assert_eq!(mem::discriminant(&actual), mem::discriminant(&expected));
Copy link
Member Author

Choose a reason for hiding this comment

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

mem::discriminant takes an enum and gives each variant an ID that can be compared. This is a workaround for the fact that currently our events can not be compared.

We might want to eventually add that #[derive(PartialEq)] to Event, but the fact that our events contain file descriptors or channels makes it non-obvious as to what behavior should be in that scenario.

@chris-olszewski chris-olszewski merged commit d985382 into main Dec 4, 2024
41 checks passed
@chris-olszewski chris-olszewski deleted the olszewski/fix_gh_9553 branch December 4, 2024 15:29
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.

tui when searching with /, h will still hide the task list
2 participants