Skip to content

Commit

Permalink
fix: remove "No newline..."
Browse files Browse the repository at this point in the history
  • Loading branch information
alecthomas committed Apr 10, 2024
1 parent 802610d commit a1597e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions assert.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ func diff[T any](before, after T, compareOptions ...CompareOption) string {
var lhss, rhss string
// Special case strings so we get nice diffs.
if l, ok := any(before).(string); ok {
lhss = l
rhss = any(after).(string)
lhss = l + "\n"
rhss = any(after).(string) + "\n"
} else {
ropts := expandCompareOptions(compareOptions...)
lhss = repr.String(before, ropts...) + "\n"
Expand Down
4 changes: 4 additions & 0 deletions assert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ func TestNotIsError(t *testing.T) {
})
}

func TestDiff(t *testing.T) {
Equal(t, "-before\n+after\n", diff("before", "after"))
}

type testTester struct {
*testing.T
failed string
Expand Down

0 comments on commit a1597e0

Please sign in to comment.