Skip to content

Commit fd07b85

Browse files
authored
Tweak image-based difference message (#188)
When in record mode, we include any difference directly in the failure, which is handy, but in the case of images "Expected snapshot to match reference" isn't quite right. I think a plain ole description "Newly-taken snapshot does not match reference" makes more sense.
1 parent 37f8adf commit fd07b85

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Sources/SnapshotTesting/Snapshotting/NSImage.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ extension Diffing where Value == NSImage {
1818
guard !compare(old, new, precision: precision) else { return nil }
1919
let difference = SnapshotTesting.diff(old, new)
2020
let message = new.size == old.size
21-
? "Expected snapshot to match reference"
22-
: "Expected snapshot@\(new.size) to match reference@\(old.size)"
21+
? "Newly-taken snapshot does not match reference"
22+
: "Newly-taken snapshot@\(new.size) does not match match reference@\(old.size)"
2323
return (
2424
message,
2525
[XCTAttachment(image: old), XCTAttachment(image: new), XCTAttachment(image: difference)]

Sources/SnapshotTesting/Snapshotting/UIImage.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ extension Diffing where Value == UIImage {
1818
guard !compare(old, new, precision: precision) else { return nil }
1919
let difference = SnapshotTesting.diff(old, new)
2020
let message = new.size == old.size
21-
? "Expected snapshot to match reference"
22-
: "Expected snapshot@\(new.size) to match reference@\(old.size)"
21+
? "Newly-taken snapshot does not match reference"
22+
: "Newly-taken snapshot@\(new.size) does not match match reference@\(old.size)"
2323
let oldAttachment = XCTAttachment(image: old)
2424
oldAttachment.name = "reference"
2525
let newAttachment = XCTAttachment(image: new)

0 commit comments

Comments
 (0)