-
Notifications
You must be signed in to change notification settings - Fork 267
Introduce WindowsOnlyAttribute and use it to simplify tests #315
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
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
bc9f696
Introduce SkipOnUnixAttribute and use it to simplify tests
fgreinacher 947820f
Move SkipReason to separate file
fgreinacher 6d58566
Use SkipOnUnix for more tests
fgreinacher 85033c0
Rename SkipOnUnixAttribute to WindowsOnlyAttribute
fgreinacher b6a744c
Improve windows-specific tests
fgreinacher cf8f6a0
Merge from master
fgreinacher 281ce44
Improve tests
fgreinacher 46ac386
Improve tests
fgreinacher 0100d56
Merge branch 'master' into chore/skip-on-unix
58ebb39
Merge branch 'chore/skip-on-unix' of github.com:fgreinacher/System.IO…
fgreinacher 1b7b9e8
Fix merge error
fgreinacher File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is one example, I think there was at least one more.
I think I'd rather see this in another test and we could add this skip attribute
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6d58566 splits this to separate tests. I'm not sure (but also not very emotional) on what I like better 🤣
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha I think the idea is better, anyway. You typically want to avoid any sort of logic within a test.
For the approach, I don't think I'd have a test that calls another test with different input. I was more thinking just explicitly put the input in the test and run the test, even if the arrange/act are similar or exact.
So you'd have something like
There really isn't a reason, that I can see anyway, to have that test data outside of the test itself (especially public ❤️ )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that's still a little bit confusing, let me know and I could whip up an example. I just think its better to be a little be repetitive in tests vs. trying to avoid repeating yourself. When it comes to tests, I think it's generally better to show as much intent/be expressive as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's what I also didn't like. b6a744c tries to improve on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woo! I just saw one more, and then I think we're good. Thanks for this! 🎉