-
Notifications
You must be signed in to change notification settings - Fork 584
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} | ||
} | ||
} |