Skip to content

Commit

Permalink
fix: typo (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
bashbunni authored Aug 7, 2024
1 parent c5da01e commit 955d6b1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions exp/golden/golden.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func RequireEqual(tb testing.TB, out []byte) {

// RequireEqualEscape is a helper function to assert the given output is
// the expected from the golden files, printing its diff in case it is not.
func RequireEqualEscape(tb testing.TB, out []byte, escapse bool) {
func RequireEqualEscape(tb testing.TB, out []byte, escapes bool) {
tb.Helper()

out = fixLineEndings(out)
Expand All @@ -47,9 +47,9 @@ func RequireEqualEscape(tb testing.TB, out []byte, escapse bool) {
goldenBts = fixLineEndings(goldenBts)
goldenStr := string(goldenBts)
outStr := string(out)
if escapse {
goldenStr = escapseSeqs(goldenStr)
outStr = escapseSeqs(outStr)
if escapes {
goldenStr = escapesSeqs(goldenStr)
outStr = escapesSeqs(outStr)
}

diff := udiff.Unified("golden", "run", goldenStr, outStr)
Expand All @@ -62,7 +62,7 @@ func fixLineEndings(in []byte) []byte {
return bytes.ReplaceAll(in, []byte("\r\n"), []byte{'\n'})
}

func escapseSeqs(in string) string {
func escapesSeqs(in string) string {
s := strings.Split(in, "\n")
for i, l := range s {
q := strconv.Quote(l)
Expand Down

0 comments on commit 955d6b1

Please sign in to comment.