Skip to content

Commit 893529d

Browse files
committed
nit: whitespace
1 parent 29c448f commit 893529d

1 file changed

Lines changed: 48 additions & 48 deletions

File tree

Sources/Testing/Events/Recorder/Event.HumanReadableOutputRecorder.swift

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -19,51 +19,51 @@ extension Event {
1919
struct FailedTest: Sendable {
2020
/// The full hierarchical path to the test (e.g., suite names).
2121
var path: [String]
22-
22+
2323
/// The test's simple name (last component of the path).
2424
var name: String
25-
25+
2626
/// All issues recorded for this test.
2727
var issues: [IssueInfo]
28-
28+
2929
/// The test's display name, if any.
3030
var displayName: String?
31-
31+
3232
/// The test case arguments for parameterized tests, if any.
3333
var testCaseArguments: String?
3434
}
35-
35+
3636
/// Information about a single issue within a failed test.
3737
struct IssueInfo: Sendable {
3838
/// The source location where the issue occurred.
3939
var sourceLocation: SourceLocation?
40-
40+
4141
/// A detailed description of what failed.
4242
var description: String
43-
43+
4444
/// Whether this issue is a known issue.
4545
var isKnown: Bool
46-
46+
4747
/// The severity of this issue.
4848
var severity: Issue.Severity
4949
}
50-
50+
5151
/// The list of failed tests collected from the test run.
5252
private let failedTests: [FailedTest]
53-
53+
5454
/// Initialize a test run summary by collecting failures from a test data graph.
5555
///
5656
/// - Parameters:
5757
/// - testData: The root test data graph to traverse.
5858
fileprivate init(from testData: Graph<HumanReadableOutputRecorder.Context.TestDataKey, HumanReadableOutputRecorder.Context.TestData?>) {
5959
var collected: [FailedTest] = []
60-
60+
6161
// Traverse the graph to find all tests with failures
6262
func traverse(graph: Graph<HumanReadableOutputRecorder.Context.TestDataKey, HumanReadableOutputRecorder.Context.TestData?>, path: [String]) {
6363
// Check if this node has test data with failures
6464
if let testData = graph.value, !testData.issues.isEmpty {
6565
let testName = path.last ?? "Unknown"
66-
66+
6767
// Convert Context.TestData.IssueInfo to TestRunSummary.IssueInfo
6868
let issues = testData.issues.map { issue in
6969
IssueInfo(
@@ -73,7 +73,7 @@ extension Event {
7373
severity: issue.severity
7474
)
7575
}
76-
76+
7777
collected.append(FailedTest(
7878
path: path,
7979
name: testName,
@@ -82,7 +82,7 @@ extension Event {
8282
testCaseArguments: testData.testCaseArguments
8383
))
8484
}
85-
85+
8686
// Recursively traverse children
8787
for (key, childGraph) in graph.children {
8888
let pathComponent: String?
@@ -102,18 +102,18 @@ extension Event {
102102
pathComponent = nil // Filter out non-parameterized test case IDs
103103
}
104104
}
105-
105+
106106
let newPath = pathComponent.map { path + [$0] } ?? path
107107
traverse(graph: childGraph, path: newPath)
108108
}
109109
}
110-
110+
111111
// Start traversal from root
112112
traverse(graph: testData, path: [])
113-
113+
114114
self.failedTests = collected
115115
}
116-
116+
117117
/// Generate a formatted failure summary string.
118118
///
119119
/// - Parameters:
@@ -126,23 +126,23 @@ extension Event {
126126
guard !failedTests.isEmpty else {
127127
return nil
128128
}
129-
129+
130130
var summary = ""
131-
131+
132132
// Add header with failure count
133133
summary += header()
134-
134+
135135
// Get the failure symbol
136136
let failSymbol = Event.Symbol.fail.stringValue(options: options)
137-
137+
138138
// Format each failed test
139139
for failedTest in failedTests {
140140
summary += formatFailedTest(failedTest, withSymbol: failSymbol)
141141
}
142-
142+
143143
return summary
144144
}
145-
145+
146146
/// Generate the summary header with failure counts.
147147
///
148148
/// - Returns: A string containing the header line.
@@ -152,7 +152,7 @@ extension Event {
152152
let issueWord = totalIssues == 1 ? "issue" : "issues"
153153
return "Test run had \(failedTests.count) failed \(testWord) with \(totalIssues) \(issueWord):\n"
154154
}
155-
155+
156156
/// Format a single failed test entry.
157157
///
158158
/// - Parameters:
@@ -162,25 +162,25 @@ extension Event {
162162
/// - Returns: A formatted string representing the failed test and its issues.
163163
private func formatFailedTest(_ failedTest: FailedTest, withSymbol symbol: String) -> String {
164164
var result = ""
165-
165+
166166
// Build fully qualified name
167167
var fullyQualifiedName = fullyQualifiedName(for: failedTest)
168-
168+
169169
result += "\(symbol) \(fullyQualifiedName)\n"
170-
170+
171171
// Show test case arguments for parameterized tests (once per test)
172172
if let arguments = failedTest.testCaseArguments, !arguments.isEmpty {
173173
result += " (\(arguments))\n"
174174
}
175-
175+
176176
// List each issue for this test with indentation
177177
for issue in failedTest.issues {
178178
result += formatIssue(issue)
179179
}
180-
180+
181181
return result
182182
}
183-
183+
184184
/// Build the fully qualified name for a failed test.
185185
///
186186
/// - Parameters:
@@ -189,16 +189,16 @@ extension Event {
189189
/// - Returns: The fully qualified name, with display name substituted if available.
190190
private func fullyQualifiedName(for failedTest: FailedTest) -> String {
191191
var name = failedTest.path.joined(separator: "/")
192-
192+
193193
// Use display name for the last component if available
194194
if let displayName = failedTest.displayName, !failedTest.path.isEmpty {
195195
let pathWithoutLast = failedTest.path.dropLast()
196196
name = (pathWithoutLast + [#""\#(displayName)""#]).joined(separator: "/")
197197
}
198-
198+
199199
return name
200200
}
201-
201+
202202
/// Format a single issue entry.
203203
///
204204
/// - Parameters:
@@ -213,7 +213,7 @@ extension Event {
213213
return result
214214
}
215215
}
216-
216+
217217
/// A type which handles ``Event`` instances and outputs representations of
218218
/// them as human-readable messages.
219219
///
@@ -273,17 +273,17 @@ extension Event {
273273
struct IssueInfo: Sendable {
274274
/// The source location where the issue occurred.
275275
var sourceLocation: SourceLocation?
276-
276+
277277
/// A detailed description of what failed (using expanded debug description).
278278
var description: String
279-
279+
280280
/// Whether this issue is a known issue.
281281
var isKnown: Bool
282-
282+
283283
/// The severity of this issue.
284284
var severity: Issue.Severity
285285
}
286-
286+
287287
/// The instant at which the test started.
288288
var startInstant: Test.Clock.Instant
289289

@@ -296,14 +296,14 @@ extension Event {
296296

297297
/// Information about the cancellation of this test or test case.
298298
var cancellationInfo: SkipInfo?
299-
299+
300300
/// Array of all issues recorded for this test (for failure summary).
301301
/// Each issue is stored individually with its own source location.
302302
var issues: [IssueInfo] = []
303-
303+
304304
/// The test's display name, if any.
305305
var displayName: String?
306-
306+
307307
/// The test case arguments, formatted for display (for parameterized tests).
308308
var testCaseArguments: String?
309309
}
@@ -547,7 +547,7 @@ extension Event.HumanReadableOutputRecorder {
547547
let issueCount = testData.issueCount[issue.severity] ?? 0
548548
testData.issueCount[issue.severity] = issueCount + 1
549549
}
550-
550+
551551
// Store individual issue information for failure summary (only for errors)
552552
if issue.severity == .error {
553553
// Extract detailed failure message
@@ -564,15 +564,15 @@ extension Event.HumanReadableOutputRecorder {
564564
} else {
565565
description = "Test failed"
566566
}
567-
567+
568568
let issueInfo = Context.TestData.IssueInfo(
569569
sourceLocation: issue.sourceLocation,
570570
description: description,
571571
isKnown: issue.isKnown,
572572
severity: issue.severity
573573
)
574574
testData.issues.append(issueInfo)
575-
575+
576576
// Capture test display name and test case arguments once per test (not per issue)
577577
if testData.displayName == nil {
578578
testData.displayName = test?.displayName
@@ -581,9 +581,9 @@ extension Event.HumanReadableOutputRecorder {
581581
testData.testCaseArguments = testCase?.labeledArguments()
582582
}
583583
}
584-
584+
585585
context.testData[keyPath] = testData
586-
586+
587587
case .testCaseStarted:
588588
context.testData[keyPath] = .init(startInstant: instant)
589589

@@ -894,7 +894,7 @@ extension Event.HumanReadableOutputRecorder {
894894

895895
return []
896896
}
897-
897+
898898
/// Generate a failure summary string with all failed tests and their issues.
899899
///
900900
/// This method creates a ``TestRunSummary`` from the test data graph and

0 commit comments

Comments
 (0)