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

Add tests for ClipboardContext and NopClipboardContext #63

Closed
wants to merge 1 commit into from

Conversation

yykamei
Copy link
Contributor

@yykamei yykamei commented Oct 18, 2023

copypasta doesn't seem to have unit tests, so I accidentally made changes with the PR: #57

I want to make sure any changes are checked by running test codes. That's why I want to add test codes.

copypasta doesn't seem to have unit tests, so I accidentally made
changes with the PR: alacritty#57

I want to make sure any changes are checked by running test codes.
That's why I want to add test codes.
Copy link
Member

@chrisduerr chrisduerr left a comment

Choose a reason for hiding this comment

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

There are no tests for the exact reason the CI is failing this build.

These tests also would not have helped with the issue you mentioned at all.

@chrisduerr chrisduerr closed this Oct 18, 2023
@yykamei yykamei deleted the add-tests branch October 18, 2023 03:27
@yykamei
Copy link
Contributor Author

yykamei commented Oct 18, 2023

OK, I understood this PR doesn't help the issue I mentioned. What should I do to avoid the issue?

@kchibisov
Copy link
Member

I mean, you could test for object safety, obviously, which is a completely different test and it doesn't require anything special.

It seems like you haven't understood what the exact reason was why I reverted the change. Basically rust can't have Box<dyn Trait> trait objects where Trait has a generic on any of its methods, so that's why your case doesn't work. What you should do instead is to basically build the clipboard and put it into the Box<dyn ClipboardProvider>, no need to actually set_contents, etc.

Just testing with Nop clipboard on its own should be more than enough. though or with doc tests. Actual building won't work.

@yykamei
Copy link
Contributor Author

yykamei commented Oct 18, 2023

Thank you for your explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants