forked from pointfreeco/swift-snapshot-testing
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from oreillymedia/fix/update-dec-2024
FIX Update to latest, including Swift Testing support
- Loading branch information
Showing
15 changed files
with
174 additions
and
59 deletions.
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
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
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
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
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,18 @@ | ||
#if canImport(Testing) | ||
import Testing | ||
import Foundation | ||
import SnapshotTesting | ||
|
||
@Suite( | ||
.snapshots( | ||
record: .missing | ||
) | ||
) | ||
struct AssertSnapshotTests { | ||
@Test func dump() { | ||
struct User { let id: Int, name: String, bio: String } | ||
let user = User(id: 1, name: "Blobby", bio: "Blobbed around the world.") | ||
assertSnapshot(of: user, as: .dump) | ||
} | ||
} | ||
#endif |
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,26 @@ | ||
#if compiler(>=6) && canImport(Testing) | ||
import Testing | ||
import SnapshotTesting | ||
|
||
@Suite(.snapshots(diffTool: "ksdiff")) | ||
struct SwiftTestingTests { | ||
@Test func testSnapshot() { | ||
assertSnapshot(of: ["Hello", "World"], as: .dump) | ||
} | ||
|
||
@Test func testSnapshotFailure() { | ||
withKnownIssue { | ||
assertSnapshot(of: ["Goodbye", "World"], as: .dump) | ||
} matching: { issue in | ||
issue.description.hasSuffix( | ||
""" | ||
@@ −1,4 +1,4 @@ | ||
▿ 2 elements | ||
− - "Hello" | ||
+ - "Goodbye" | ||
- "World" | ||
""") | ||
} | ||
} | ||
} | ||
#endif |
4 changes: 4 additions & 0 deletions
4
Tests/SnapshotTestingTests/__Snapshots__/AssertSnapshotSwiftTests/dump.1.txt
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,4 @@ | ||
▿ User | ||
- bio: "Blobbed around the world." | ||
- id: 1 | ||
- name: "Blobby" |
3 changes: 3 additions & 0 deletions
3
Tests/SnapshotTestingTests/__Snapshots__/SwiftTestingTests/testSnapshot.1.txt
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,3 @@ | ||
▿ 2 elements | ||
- "Hello" | ||
- "World" |
3 changes: 3 additions & 0 deletions
3
Tests/SnapshotTestingTests/__Snapshots__/SwiftTestingTests/testSnapshotFailure.1.txt
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,3 @@ | ||
▿ 2 elements | ||
- "Hello" | ||
- "World" |