Skip to content
This repository has been archived by the owner on Feb 19, 2024. It is now read-only.

Commit

Permalink
Tweak image-based difference message (pointfreeco#188)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
stephencelis authored Mar 12, 2019
1 parent 37f8adf commit fd07b85
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Sources/SnapshotTesting/Snapshotting/NSImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ extension Diffing where Value == NSImage {
guard !compare(old, new, precision: precision) else { return nil }
let difference = SnapshotTesting.diff(old, new)
let message = new.size == old.size
? "Expected snapshot to match reference"
: "Expected snapshot@\(new.size) to match reference@\(old.size)"
? "Newly-taken snapshot does not match reference"
: "Newly-taken snapshot@\(new.size) does not match match reference@\(old.size)"
return (
message,
[XCTAttachment(image: old), XCTAttachment(image: new), XCTAttachment(image: difference)]
Expand Down
4 changes: 2 additions & 2 deletions Sources/SnapshotTesting/Snapshotting/UIImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ extension Diffing where Value == UIImage {
guard !compare(old, new, precision: precision) else { return nil }
let difference = SnapshotTesting.diff(old, new)
let message = new.size == old.size
? "Expected snapshot to match reference"
: "Expected snapshot@\(new.size) to match reference@\(old.size)"
? "Newly-taken snapshot does not match reference"
: "Newly-taken snapshot@\(new.size) does not match match reference@\(old.size)"
let oldAttachment = XCTAttachment(image: old)
oldAttachment.name = "reference"
let newAttachment = XCTAttachment(image: new)
Expand Down

0 comments on commit fd07b85

Please sign in to comment.