Skip to content

Commit ebd1dbc

Browse files
committed
Updated documentation
1 parent 6f4da01 commit ebd1dbc

23 files changed

+165
-368
lines changed

README.md

Lines changed: 85 additions & 221 deletions
Large diffs are not rendered by default.

Sources/InlineSnapshotTesting/AssertInline.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import Foundation
22
@_spi(Internals) import XCTSnapshot
3-
@preconcurrency import XCTest
43

54
#if canImport(SwiftSyntax601)
65
@_spi(Internals) import XCTSnapshot
76
import SwiftParser
87
import SwiftSyntax
98
import SwiftSyntaxBuilder
10-
import XCTest
119

1210
/// Asserts that a given value matches an inline string snapshot using the specified snapshot testing strategy.
1311
///
@@ -74,15 +72,15 @@ public func assertInline<Input: Sendable, Output: BytesRepresentable>(
7472

7573
switch failure.reason {
7674
case .doesNotMatch:
77-
closureDescriptor.fail(
75+
try closureDescriptor.fail(
7876
failure.message,
7977
fileID: fileID,
8078
file: filePath,
8179
line: line,
8280
column: column
8381
)
8482
default:
85-
TestingSystem.shared.record(
83+
try TestingSystem.shared.record(
8684
message: failure.message,
8785
fileID: fileID,
8886
filePath: filePath,
@@ -158,15 +156,15 @@ public func assertInline<Input, Output: BytesRepresentable>(
158156

159157
switch failure.reason {
160158
case .doesNotMatch:
161-
closureDescriptor.fail(
159+
try closureDescriptor.fail(
162160
failure.message,
163161
fileID: fileID,
164162
file: filePath,
165163
line: line,
166164
column: column
167165
)
168166
default:
169-
TestingSystem.shared.record(
167+
try TestingSystem.shared.record(
170168
message: failure.message,
171169
fileID: fileID,
172170
filePath: filePath,

Sources/InlineSnapshotTesting/SnapshotInlineEngine.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#if canImport(SwiftSyntax601)
22
import SwiftSyntax
3-
import XCTest
3+
import Foundation
44
@_spi(Internals) import XCTSnapshot
55

66
struct SnapshotInlineEngine<Executor: SnapshotExecutor>: SnapshotEngine where Executor.Output: BytesRepresentable {

Sources/InlineSnapshotTesting/SnapshotInlineObservation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@_spi(Internals) import XCTSnapshot
2-
import XCTest
2+
import Foundation
33

44
final class SnapshotInlineObservation: @unchecked Sendable {
55

Sources/InlineSnapshotTesting/SwiftSyntax/SnapshotClosureDescriptor.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public struct SnapshotClosureDescriptor: Sendable, Hashable {
100100
file filePath: StaticString,
101101
line: UInt,
102102
column: UInt
103-
) {
103+
) throws {
104104
var trailingClosureLine: Int?
105105
if let testSource = InlineSnapshotManager.current[SnapshotURL(path: filePath)] {
106106
let visitor = SnapshotVisitor(
@@ -113,7 +113,7 @@ public struct SnapshotClosureDescriptor: Sendable, Hashable {
113113
trailingClosureLine = visitor.trailingClosureLine
114114
}
115115

116-
TestingSystem.shared.record(
116+
try TestingSystem.shared.record(
117117
message: message(),
118118
fileID: fileID,
119119
filePath: filePath,

Sources/XCTSnapshot/Assert/Assert.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import XCTest
1+
import Foundation
22

33
// MARK: - Assert snapshot
44

@@ -73,7 +73,7 @@ public func assert<Input: Sendable, Output: BytesRepresentable>(
7373

7474
guard let message = failure else { return }
7575

76-
TestingSystem.shared.record(
76+
try TestingSystem.shared.record(
7777
message: message,
7878
fileID: fileID,
7979
filePath: filePath,
@@ -295,7 +295,7 @@ public func assert<Input, Output: BytesRepresentable>(
295295

296296
guard let message = failure else { return }
297297

298-
TestingSystem.shared.record(
298+
try TestingSystem.shared.record(
299299
message: message,
300300
fileID: fileID,
301301
filePath: filePath,

Sources/XCTSnapshot/Assert/CleanCounterBetweenTestCases.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if canImport(XCTest)
12
import XCTest
23

34
final class CleanCounterBetweenTestCases: NSObject, XCTestObservation {
@@ -27,6 +28,7 @@ extension XCTestCase {
2728
CleanCounterBetweenTestCases.registerIfNeeded()
2829
}
2930
}
31+
#endif
3032

3133
@_spi(Internals)
3234
public let XCTestBundleDidFinishNotification = Notification.Name(

Sources/XCTSnapshot/Diff/Defaults/DataDiffAttachmentGenerator.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Foundation
2-
import XCTest
32

43
/// A diff attachment generator that compares two data blobs (typically images or binary snapshots) and generates an attachment describing any differences.
54
///

Sources/XCTSnapshot/Diff/Defaults/ImageDiffAttachmentGenerator.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
@preconcurrency import XCTest
2-
31
#if os(iOS) || os(tvOS) || os(watchOS)
42
import UIKit
53
#elseif os(macOS)

Sources/XCTSnapshot/Diff/Defaults/StringDiffAttachmentGenerator.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Foundation
2-
import XCTest
32

43
/// A diff attachment generator that compares two UTF-8 strings line-by-line and produces a patch-style text diff
54
/// as an `SnapshotAttachment`. Calculates differences between collections using the Longest Common

0 commit comments

Comments
 (0)