Skip to content

Commit b711f20

Browse files
stephencelisgithub-actions[bot]
authored andcommitted
Run swift-format
1 parent eb910d0 commit b711f20

File tree

13 files changed

+141
-138
lines changed

13 files changed

+141
-138
lines changed

Examples/ExamplesTests/SwiftTestingTests.swift

Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,85 @@
11
#if canImport(Testing)
2-
import IssueReporting
3-
import Testing
2+
import IssueReporting
3+
import Testing
44

5-
#if DEBUG
6-
@Suite
7-
struct SwiftTestingTests_Debug {
8-
@Test func context() {
9-
#expect(TestContext.current == .swiftTesting)
10-
}
5+
#if DEBUG
6+
@Suite
7+
struct SwiftTestingTests_Debug {
8+
@Test func context() {
9+
#expect(TestContext.current == .swiftTesting)
10+
}
1111

12-
@Test func reportIssue_NoMessage() {
13-
withKnownIssue {
14-
reportIssue()
15-
} matching: { issue in
16-
issue.description == "Expectation failed: "
17-
}
18-
}
12+
@Test func reportIssue_NoMessage() {
13+
withKnownIssue {
14+
reportIssue()
15+
} matching: { issue in
16+
issue.description == "Expectation failed: "
17+
}
18+
}
1919

20-
@Test func reportIssue_CustomMessage() {
21-
withKnownIssue {
22-
reportIssue("Something went wrong")
23-
} matching: { issue in
24-
issue.description == "Expectation failed: Something went wrong"
25-
}
26-
}
20+
@Test func reportIssue_CustomMessage() {
21+
withKnownIssue {
22+
reportIssue("Something went wrong")
23+
} matching: { issue in
24+
issue.description == "Expectation failed: Something went wrong"
25+
}
26+
}
2727

28-
@Test func withExpectedIssue_reportIssue() {
29-
withExpectedIssue {
30-
reportIssue()
31-
}
32-
}
28+
@Test func withExpectedIssue_reportIssue() {
29+
withExpectedIssue {
30+
reportIssue()
31+
}
32+
}
3333

34-
@Test func withExpectedIssue_issueRecord() {
35-
withExpectedIssue {
36-
Issue.record()
37-
}
38-
}
34+
@Test func withExpectedIssue_issueRecord() {
35+
withExpectedIssue {
36+
Issue.record()
37+
}
38+
}
3939

40-
@Test func withExpectedIssue_throw() {
41-
withExpectedIssue { throw Failure() }
42-
}
40+
@Test func withExpectedIssue_throw() {
41+
withExpectedIssue { throw Failure() }
42+
}
4343

44-
@Test func withExpectedIssue_NoMessage_NoIssue() {
45-
withKnownIssue {
46-
withExpectedIssue {
44+
@Test func withExpectedIssue_NoMessage_NoIssue() {
45+
withKnownIssue {
46+
withExpectedIssue {
47+
}
48+
} matching: { issue in
49+
issue.description == "Known issue was not recorded"
50+
}
4751
}
48-
} matching: { issue in
49-
issue.description == "Known issue was not recorded"
50-
}
51-
}
5252

53-
@Test func withExpectedIssue_CustomMessage_NoIssue() {
54-
withKnownIssue {
55-
withExpectedIssue("This didn't fail") {
53+
@Test func withExpectedIssue_CustomMessage_NoIssue() {
54+
withKnownIssue {
55+
withExpectedIssue("This didn't fail") {
56+
}
57+
} matching: { issue in
58+
issue.description == "Known issue was not recorded: This didn't fail"
59+
}
5660
}
57-
} matching: { issue in
58-
issue.description == "Known issue was not recorded: This didn't fail"
59-
}
60-
}
6161

62-
@Test func withExpectedIssue_IsIntermittent() async throws {
63-
withExpectedIssue(isIntermittent: true) {
62+
@Test func withExpectedIssue_IsIntermittent() async throws {
63+
withExpectedIssue(isIntermittent: true) {
64+
}
65+
}
6466
}
65-
}
66-
}
67-
#else
68-
@Suite
69-
struct SwiftTestingTests_Release {
70-
@Test func context() {
71-
#expect(TestContext.current == .xcTest)
72-
}
67+
#else
68+
@Suite
69+
struct SwiftTestingTests_Release {
70+
@Test func context() {
71+
#expect(TestContext.current == .xcTest)
72+
}
7373

74-
@Test func reportIssueDoesNotFail() {
75-
reportIssue()
76-
}
74+
@Test func reportIssueDoesNotFail() {
75+
reportIssue()
76+
}
7777

78-
@Test func withExpectedIssueDoesNotFail() {
79-
withExpectedIssue {}
80-
}
81-
}
82-
#endif
78+
@Test func withExpectedIssueDoesNotFail() {
79+
withExpectedIssue {}
80+
}
81+
}
82+
#endif
8383

8484
#endif
8585

Examples/ExamplesTests/XCTestTests.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,19 @@ import XCTest
4747
#endif
4848
}
4949
#else
50-
class XCTestTests_Release: XCTestCase {
51-
func testContext() {
52-
XCTAssertEqual(TestContext.current, .xcTest)
53-
}
54-
55-
func testReportIssueDoesNotFail() {
56-
reportIssue()
57-
}
58-
59-
func testWithExpectedIssueNoIssueDoesNotFail() {
60-
withExpectedIssue {}
61-
}
62-
}
50+
class XCTestTests_Release: XCTestCase {
51+
func testContext() {
52+
XCTAssertEqual(TestContext.current, .xcTest)
53+
}
54+
55+
func testReportIssueDoesNotFail() {
56+
reportIssue()
57+
}
58+
59+
func testWithExpectedIssueNoIssueDoesNotFail() {
60+
withExpectedIssue {}
61+
}
62+
}
6363
#endif
6464

6565
private struct Failure: Error {}

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ let package = Package(
3737
name: "XCTestDynamicOverlayTests",
3838
dependencies: [
3939
"IssueReportingTestSupport",
40-
"XCTestDynamicOverlay"
40+
"XCTestDynamicOverlay",
4141
]
4242
),
4343
]

Package@swift-6.0.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ let package = Package(
3737
name: "XCTestDynamicOverlayTests",
3838
dependencies: [
3939
"IssueReportingTestSupport",
40-
"XCTestDynamicOverlay"
40+
"XCTestDynamicOverlay",
4141
]
4242
),
4343
],

Sources/IssueReporting/Internal/AppHostWarning.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ extension String {
4141
https://pointfreeco.github.io/swift-dependencies/main/documentation/dependencies/testing#Testing-gotchas
4242
"""
4343

44-
return isEmpty ? warning : """
44+
return isEmpty
45+
? warning
46+
: """
4547
\(self)
4648
4749
━━┉┅
@@ -71,7 +73,7 @@ extension String {
7173
.map {
7274
(_typeByName(String(self[$0])) as? NSObject.Type)?.isSubclass(of: xcTestCase) ?? false
7375
}
74-
?? false
76+
?? false
7577
}
7678
#endif
7779
}

Sources/IssueReporting/Internal/SwiftTesting.swift

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func _recordIssue(
5757
printError(
5858
"""
5959
\(fileID):\(line): An issue was recorded without linking the Testing framework.
60-
60+
6161
To fix this, add "IssueReportingTestSupport" as a dependency to your test target.
6262
"""
6363
)
@@ -138,14 +138,12 @@ func _withKnownIssue(
138138
H0VyyKXEtF
139139
""",
140140
in: "Testing",
141-
to: (
142-
@convention(thin) (
143-
Any?,
144-
Bool,
145-
SourceLocation,
146-
() throws -> Void
147-
) -> Void
148-
)
141+
to: (@convention(thin) (
142+
Any?,
143+
Bool,
144+
SourceLocation,
145+
() throws -> Void
146+
) -> Void)
149147
.self
150148
)
151149
else { return }
@@ -174,15 +172,17 @@ func _withKnownIssue(
174172
return
175173
}
176174

177-
let withKnownIssue = function as! @Sendable (
178-
String?,
179-
Bool,
180-
String,
181-
String,
182-
Int,
183-
Int,
184-
() throws -> Void
185-
) -> Void
175+
let withKnownIssue =
176+
function
177+
as! @Sendable (
178+
String?,
179+
Bool,
180+
String,
181+
String,
182+
Int,
183+
Int,
184+
() throws -> Void
185+
) -> Void
186186
withKnownIssue(message, isIntermittent, fileID, filePath, line, column, body)
187187
}
188188

@@ -206,14 +206,12 @@ func _withKnownIssue(
206206
H0VyyYaKXEtYaFTu
207207
""",
208208
in: "Testing",
209-
to: (
210-
@convention(thin) (
211-
Any?,
212-
Bool,
213-
SourceLocation,
214-
() async throws -> Void
215-
) async -> Void
216-
)
209+
to: (@convention(thin) (
210+
Any?,
211+
Bool,
212+
SourceLocation,
213+
() async throws -> Void
214+
) async -> Void)
217215
.self
218216
)
219217
else { return }
@@ -242,15 +240,17 @@ func _withKnownIssue(
242240
return
243241
}
244242

245-
let withKnownIssue = function as! @Sendable (
246-
String?,
247-
Bool,
248-
String,
249-
String,
250-
Int,
251-
Int,
252-
() async throws -> Void
253-
) async -> Void
243+
let withKnownIssue =
244+
function
245+
as! @Sendable (
246+
String?,
247+
Bool,
248+
String,
249+
String,
250+
Int,
251+
Int,
252+
() async throws -> Void
253+
) async -> Void
254254
await withKnownIssue(message, isIntermittent, fileID, filePath, line, column, body)
255255
}
256256
@usableFromInline
@@ -263,7 +263,7 @@ func _currentTestIsNotNil() -> Bool {
263263
printError(
264264
"""
265265
'Test.current' was accessed without linking the Testing framework.
266-
266+
267267
To fix this, add "IssueReportingTestSupport" as a dependency to your test target.
268268
"""
269269
)

Sources/IssueReporting/Internal/Warn.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#if os(Linux)
2-
@preconcurrency import Foundation
2+
@preconcurrency import Foundation
33
#else
4-
import Foundation
4+
import Foundation
55
#endif
66

77
#if canImport(WinSDK)

Sources/IssueReporting/Internal/XCTest.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,15 @@ func _XCTExpectFailure<R>(
8484
printError(
8585
"""
8686
\(file):\(line): An expected failure was recorded without linking the XCTest framework.
87-
87+
8888
To fix this, add "IssueReportingTestSupport" as a dependency to your test target.
8989
"""
9090
)
9191
#endif
9292
return try failingBlock()
9393
}
94-
let XCTExpectFailure = function
94+
let XCTExpectFailure =
95+
function
9596
as! @Sendable (String?, Bool?, Bool?, () throws -> Void) throws -> Void
9697
var result: Result<R, any Error>!
9798
do {

Sources/IssueReporting/IsTesting.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
/// To detect if the current task is running inside a test, use ``TestContext/current``, instead.
2626
public let isTesting = ProcessInfo.processInfo.isTesting
2727

28-
private extension ProcessInfo {
29-
var isTesting: Bool {
28+
extension ProcessInfo {
29+
fileprivate var isTesting: Bool {
3030
if environment.keys.contains("XCTestBundlePath") { return true }
3131
if environment.keys.contains("XCTestConfigurationFilePath") { return true }
3232
if environment.keys.contains("XCTestSessionIdentifier") { return true }

Sources/IssueReporting/IssueReporters/RuntimeWarningReporter.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ public struct RuntimeWarningReporter: IssueReporter {
3030
#endif
3131
@usableFromInline var dso: UnsafeRawPointer
3232

33-
init(dso: UnsafeRawPointer) {
34-
self.dso = dso
35-
}
33+
init(dso: UnsafeRawPointer) {
34+
self.dso = dso
35+
}
3636

37-
@usableFromInline
37+
@usableFromInline
3838
init() {
3939
// NB: Xcode runtime warnings offer a much better experience than traditional assertions and
4040
// breakpoints, but Apple provides no means of creating custom runtime warnings ourselves.

0 commit comments

Comments
 (0)