Skip to content

Commit 3ef8b2f

Browse files
committed
Fix some test terminology
1 parent 3ba41e0 commit 3ef8b2f

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

Tests/TestingTests/Traits/AttachmentSavingTraitTests.swift

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
@testable @_spi(Experimental) @_spi(ForToolsIntegrationOnly) import Testing
1212

13-
struct `Attachment.ConditionalRecordingTrait tests` {
14-
func runRecordingAttachmentTests(with trait: AttachmentSavingTrait?, expectedCount: Int, expectedIssueCount: Int = Self.issueCountFromTestBodies, expectedPreferredName: String?) async throws {
15-
let traitToApply = trait as (any SuiteTrait)? ?? Self.currentRecordingAttachmentsTrait
16-
try await Self.$currentRecordingAttachmentsTrait.withValue(traitToApply) {
13+
struct `AttachmentSavingTrait tests` {
14+
func runAttachmentSavingTests(with trait: AttachmentSavingTrait?, expectedCount: Int, expectedIssueCount: Int = Self.issueCountFromTestBodies, expectedPreferredName: String?) async throws {
15+
let traitToApply = trait as (any SuiteTrait)? ?? Self.currentAttachmentSavingTrait
16+
try await Self.$currentAttachmentSavingTrait.withValue(traitToApply) {
1717
try await confirmation("Issue recorded", expectedCount: expectedIssueCount) { issueRecorded in
1818
try await confirmation("Attachment detected", expectedCount: expectedCount) { valueAttached in
1919
var configuration = Configuration()
@@ -41,62 +41,62 @@ struct `Attachment.ConditionalRecordingTrait tests` {
4141
}
4242
}
4343

44-
@Test func `Recording attachments without conditions`() async throws {
45-
try await runRecordingAttachmentTests(
44+
@Test func `Saving attachments without conditions`() async throws {
45+
try await runAttachmentSavingTests(
4646
with: nil,
4747
expectedCount: Self.totalTestCaseCount,
4848
expectedPreferredName: nil
4949
)
5050
}
5151

52-
@Test func `Recording attachments only on test pass`() async throws {
53-
try await runRecordingAttachmentTests(
52+
@Test func `Saving attachments only on test pass`() async throws {
53+
try await runAttachmentSavingTests(
5454
with: .savingAttachments(if: .testPasses),
5555
expectedCount: Self.passingTestCaseCount,
5656
expectedPreferredName: "PASSING TEST"
5757
)
5858
}
5959

60-
@Test func `Recording attachments only on test failure`() async throws {
61-
try await runRecordingAttachmentTests(
60+
@Test func `Saving attachments only on test failure`() async throws {
61+
try await runAttachmentSavingTests(
6262
with: .savingAttachments(if: .testFails),
6363
expectedCount: Self.failingTestCaseCount,
6464
expectedPreferredName: "FAILING TEST"
6565
)
6666
}
6767

68-
@Test func `Recording attachments with custom condition`() async throws {
69-
try await runRecordingAttachmentTests(
68+
@Test func `Saving attachments with custom condition`() async throws {
69+
try await runAttachmentSavingTests(
7070
with: .savingAttachments(if: true),
7171
expectedCount: Self.totalTestCaseCount,
7272
expectedPreferredName: nil
7373
)
7474

75-
try await runRecordingAttachmentTests(
75+
try await runAttachmentSavingTests(
7676
with: .savingAttachments(if: false),
7777
expectedCount: 0,
7878
expectedPreferredName: nil
7979
)
8080
}
8181

82-
@Test func `Recording attachments with custom async condition`() async throws {
82+
@Test func `Saving attachments with custom async condition`() async throws {
8383
@Sendable func conditionFunction() async -> Bool {
8484
true
8585
}
8686

87-
try await runRecordingAttachmentTests(
87+
try await runAttachmentSavingTests(
8888
with: .savingAttachments(if: conditionFunction),
8989
expectedCount: Self.totalTestCaseCount,
9090
expectedPreferredName: nil
9191
)
9292
}
9393

94-
@Test func `Recording attachments but the condition throws`() async throws {
94+
@Test func `Saving attachments but the condition throws`() async throws {
9595
@Sendable func conditionFunction() throws -> Bool {
9696
throw MyError()
9797
}
9898

99-
try await runRecordingAttachmentTests(
99+
try await runAttachmentSavingTests(
100100
with: .savingAttachments(if: conditionFunction),
101101
expectedCount: 0,
102102
expectedIssueCount: Self.issueCountFromTestBodies + Self.totalTestCaseCount /* thrown from conditionFunction */,
@@ -107,16 +107,16 @@ struct `Attachment.ConditionalRecordingTrait tests` {
107107

108108
// MARK: - Fixtures
109109

110-
extension `Attachment.ConditionalRecordingTrait tests` {
110+
extension `AttachmentSavingTrait tests` {
111111
static let totalTestCaseCount = 1 + 1 + 5 + 7
112112
static let passingTestCaseCount = 1 + 5
113113
static let failingTestCaseCount = 1 + 7
114114
static let issueCountFromTestBodies = failingTestCaseCount
115115

116116
@TaskLocal
117-
static var currentRecordingAttachmentsTrait: any SuiteTrait = Comment(rawValue: "<no .recordingAttachments trait set>")
117+
static var currentAttachmentSavingTrait: any SuiteTrait = Comment(rawValue: "<no .savingAttachments trait set>")
118118

119-
@Suite(.hidden, currentRecordingAttachmentsTrait)
119+
@Suite(.hidden, currentAttachmentSavingTrait)
120120
struct FixtureSuite {
121121
@Test(.hidden) func `Records an attachment (passing)`() {
122122
Attachment.record("", named: "PASSING TEST")

0 commit comments

Comments
 (0)