Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/Testing/ABI/EntryPoints/EntryPoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func entryPoint(passing args: __CommandLineArguments_v0?, eventHandler: Event.Ha

// Set up the event handler.
configuration.eventHandler = { [oldEventHandler = configuration.eventHandler] event, context in
if case let .issueRecorded(issue) = event.kind, !issue.isKnown, issue.severity >= .error {
if case let .issueRecorded(issue) = event.kind, issue.isFailure {
exitCode.withLock { exitCode in
exitCode = EXIT_FAILURE
}
Expand Down
6 changes: 6 additions & 0 deletions Sources/Testing/Issues/Issue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ public struct Issue: Sendable {
/// The severity of this issue.
@_spi(Experimental)
public var severity: Severity

/// If the issues is a failing issue.
@_spi(Experimental)
public var isFailure: Bool {
return !self.isKnown && self.severity >= .error
}

/// Any comments provided by the developer and associated with this issue.
///
Expand Down
2 changes: 2 additions & 0 deletions Tests/TestingTests/IssueTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,7 @@ final class IssueTests: XCTestCase {
}
XCTAssertFalse(issue.isKnown)
XCTAssertEqual(issue.severity, .error)
XCTAssertTrue(issue.isFailure)
guard case .unconditional = issue.kind else {
XCTFail("Unexpected issue kind \(issue.kind)")
return
Expand All @@ -1031,6 +1032,7 @@ final class IssueTests: XCTestCase {
}
XCTAssertFalse(issue.isKnown)
XCTAssertEqual(issue.severity, .warning)
XCTAssertFalse(issue.isFailure)
guard case .unconditional = issue.kind else {
XCTFail("Unexpected issue kind \(issue.kind)")
return
Expand Down
3 changes: 2 additions & 1 deletion Tests/TestingTests/KnownIssueTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#if canImport(XCTest)
import XCTest
@testable @_spi(ForToolsIntegrationOnly) import Testing
@testable @_spi(Experimental) @_spi(ForToolsIntegrationOnly) import Testing

final class KnownIssueTests: XCTestCase {
func testIssueIsKnownPropertyIsSetCorrectly() async {
Expand All @@ -26,6 +26,7 @@ final class KnownIssueTests: XCTestCase {
issueRecorded.fulfill()

XCTAssertTrue(issue.isKnown)
XCTAssertFalse(issue.isFailure)
}

await Test {
Expand Down