-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
suite: fix SetupSubTest and TearDownSubTest execution order #1471
Merged
dolmen
merged 8 commits into
stretchr:master
from
linusbarth:fix-setup-and-teardown-subtest-execution-order
Oct 30, 2023
Merged
suite: fix SetupSubTest and TearDownSubTest execution order #1471
dolmen
merged 8 commits into
stretchr:master
from
linusbarth:fix-setup-and-teardown-subtest-execution-order
Oct 30, 2023
Commits on Oct 16, 2023
-
fix: SetupSubTest and TearDownSubTest execution order
There were two problems with the order of execution in the Suite.Run() method: - One could not access the correct testing context ("s.T()") inside the SetupSubTest and TearDownSubTest methods. If the testing context was used for e.g. assertions of mocks in the TearDownSubTest, the results would not be "attached" to the correct test in the test output. - The behavior was different to the order of execution for "root" tests (see lines 167-201) regarding the SetupTest and TearDownTest methods. This could confuse users of the library. Also the logic to be deferred was joined together. This was fine beforehand because a panic in the TearDownSubTest would have had no influence on the "suite.SetT(oldT)". Now since a panic in the TearDownSubTest would lead to omitting the "suite.SetT(oldT)" this defer was split into two separate defers.
Configuration menu - View commit details
-
Copy full SHA for 916ce79 - Browse repository at this point
Copy the full SHA 916ce79View commit details -
Configuration menu - View commit details
-
Copy full SHA for 83e44bc - Browse repository at this point
Copy the full SHA 83e44bcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4657972 - Browse repository at this point
Copy the full SHA 4657972View commit details -
Configuration menu - View commit details
-
Copy full SHA for aa01ed0 - Browse repository at this point
Copy the full SHA aa01ed0View commit details -
Configuration menu - View commit details
-
Copy full SHA for ac5cd69 - Browse repository at this point
Copy the full SHA ac5cd69View commit details
Commits on Oct 17, 2023
-
Configuration menu - View commit details
-
Copy full SHA for c8efd3c - Browse repository at this point
Copy the full SHA c8efd3cView commit details
Commits on Oct 18, 2023
-
fix: panic behavior for subtests
This fix adds panic handling for subtests which will achieve: - subtests will fail for the correct test context when panicking - the test execution is not stopped; the next subtest will be executed
Configuration menu - View commit details
-
Copy full SHA for 91478fe - Browse repository at this point
Copy the full SHA 91478feView commit details -
Configuration menu - View commit details
-
Copy full SHA for c18759c - Browse repository at this point
Copy the full SHA c18759cView commit details
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.