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

chore: use subtests in all unit tests #161

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Ozoniuss
Copy link

@Ozoniuss Ozoniuss commented Nov 21, 2023

Changes all (remaining) unit tests to use subtests. I pretty much followed the same implementation that some were already using, which is the same as the one from Dave Cheney's blog blog, or one of your own repositories.

This PR is very big, so I did not change anything else except putting the original tests into subtests and fix three (likely) writing issues. To make it easy to find them, see:

  • line 79 in graph_test.go (changed *directed to *undirected)
  • lines 77 and 152 in path_test.go

Some other considerations:

  • I replaced all continue statements with t.SkipNow()
  • This won't work if you want to run the tests in parallel, unless you rebind the testcase variable inside each for loop. Or alternatively it could use the new experimental environment variable, but that is only avaliable in go 1.21.
  • I use gofmt from within Vscode, and some minor formatting differences may show up on the diff. Let me know if you have any formatter preferences

closes #68

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.

Change unit tests to use subtests
1 participant