-
Notifications
You must be signed in to change notification settings - Fork 127
Report a skipped event for parameterized tests with no cases #572
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
Conversation
When a parameterized test's argument list is empty, a "skip" event is a better reflection of the fact that the test function doesn't actually get executed.
|
@swift-ci please test |
grynspan
left a comment
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.
Nitpicks only.
Tests/TestingTests/RunnerTests.swift
Outdated
| let testSkipped = expectation(description: "Test was skipped") | ||
| var configuration = Configuration() | ||
| configuration.eventHandler = { event, _ in | ||
| if case .testSkipped(_) = event.kind { |
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 case .testSkipped(_) = event.kind { | |
| if case .testSkipped = event.kind { |
| } | ||
|
|
||
| // If the test is parameterized but has no cases, mark it as skipped. | ||
| if case .run = action, test.isParameterized, test.testCases?.lazy.first(where: { _ in true }) == nil { |
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 case .run = action, test.isParameterized, test.testCases?.lazy.first(where: { _ in true }) == nil { | |
| if case .run = action, test.isParameterized, test.testCases?.first(where: { _ in true }) == nil { |
|
@swift-ci please test |
| } | ||
|
|
||
| // If the test is parameterized but has no cases, mark it as skipped. | ||
| if case .run = action, test.isParameterized, test.testCases?.first(where: { _ in true }) == nil { |
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.
We could also express this as:
if case .run = action, let testCases = test.testCases, testCases.first(where: { _ in true }) == nil {Which might be slightly more efficient.
|
@swift-ci please test |
|
Merging on Brian's behalf. |
When a parameterized test's argument list is empty, a "skip" event is a better reflection of the fact that the test function doesn't actually get executed.
With this change, a
.testSkippedevent will get posted for such tests, instead of a.testStarted+.testEndedevent pair.This also means that the following tests will be reported very similarly (with just a different comment on the
SkipInfo):Checklist: