From b1bc5c149182b56fb5b52cc64b49461338549e4d Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Sat, 25 Jan 2025 00:13:47 -0800 Subject: [PATCH] wip --- Package.swift | 3 ++- .../CustomDumpTests.swift | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 Tests/InlineSnapshotTestingTests/CustomDumpTests.swift diff --git a/Package.swift b/Package.swift index 719e30b2d..01ee0e626 100644 --- a/Package.swift +++ b/Package.swift @@ -35,7 +35,7 @@ let package = Package( .testTarget( name: "SnapshotTestingTests", dependencies: [ - "SnapshotTesting" + "SnapshotTesting", ], exclude: [ "__Fixtures__", @@ -46,6 +46,7 @@ let package = Package( name: "InlineSnapshotTesting", dependencies: [ "SnapshotTesting", + "SnapshotTestingCustomDump", .product(name: "SwiftParser", package: "swift-syntax"), .product(name: "SwiftSyntax", package: "swift-syntax"), .product(name: "SwiftSyntaxBuilder", package: "swift-syntax"), diff --git a/Tests/InlineSnapshotTestingTests/CustomDumpTests.swift b/Tests/InlineSnapshotTestingTests/CustomDumpTests.swift new file mode 100644 index 000000000..cd1d26a22 --- /dev/null +++ b/Tests/InlineSnapshotTestingTests/CustomDumpTests.swift @@ -0,0 +1,26 @@ +#if canImport(Testing) + import Testing + import InlineSnapshotTesting + import SnapshotTestingCustomDump + + @Suite( + .snapshots( + record: .missing + ) + ) + struct CustomDumpSnapshotTests { + @Test func basics() { + struct User { let id: Int, name: String, bio: String } + let user = User(id: 1, name: "Blobby", bio: "Blobbed around the world.") + assertInlineSnapshot(of: user, as: .customDump) { + """ + CustomDumpSnapshotTests.User( + id: 1, + name: "Blobby", + bio: "Blobbed around the world." + ) + """ + } + } + } +#endif