Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrandonw committed Jul 8, 2024
1 parent 2dc8dab commit ea63fe0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Tests/SnapshotTestingTests/SnapshotsTraitTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct SnapshotsTraitTests {
#expect(SnapshotTestingConfiguration.current?.record == .all)
}

@Suite(.snapshots(diffTool: "diff", record: .failed))
@Suite(.snapshots(record: .failed, diffTool: "diff"))
struct OverrideDiffToolAndRecord {
@Test
func config() {
Expand Down
35 changes: 35 additions & 0 deletions Tests/SnapshotTestingTests/WithSnapshotTestingTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import XCTest

@_spi(Internals) @testable import SnapshotTesting

class WithSnapshotTestingTests: XCTestCase {
func testNesting() {
withSnapshotTesting(record: .all) {
XCTAssertEqual(
SnapshotTestingConfiguration.current?
.diffTool?(currentFilePath: "old.png", failedFilePath: "new.png"),
"""
@−
"file://old.png"
@+
"file://new.png"
To configure output for a custom diff tool, use 'withSnapshotTesting'. For example:
withSnapshotTesting(diffTool: .ksdiff) {
// ...
}
"""
)
XCTAssertEqual(SnapshotTestingConfiguration.current?.record, .all)
withSnapshotTesting(diffTool: "ksdiff") {
XCTAssertEqual(
SnapshotTestingConfiguration.current?
.diffTool?(currentFilePath: "old.png", failedFilePath: "new.png"),
"ksdiff old.png new.png"
)
XCTAssertEqual(SnapshotTestingConfiguration.current?.record, .all)
}
}
}
}

0 comments on commit ea63fe0

Please sign in to comment.