Skip to content

Commit bbe4726

Browse files
aiskncw
authored andcommitted
pytest: ensure expected string's line sep is \n
1 parent 8b4dffb commit bbe4726

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

main_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ func TestGPython(t *testing.T) {
4848
}
4949

5050
want, err := os.ReadFile(fname)
51+
want = bytes.ReplaceAll(want, []byte("\r\n"), []byte("\n"))
5152
if err != nil {
5253
t.Fatalf("could not read golden file: %+v", err)
5354
}

pytest/pytest.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ func (task *Task) run() error {
273273
return fmt.Errorf("could not read golden output %q: %w", task.GoldFile, err)
274274
}
275275

276+
want = bytes.ReplaceAll(want, []byte("\r\n"), []byte("\n"))
276277
diff := cmp.Diff(string(want), string(got))
277278
if !bytes.Equal(got, want) {
278279
out := fileBase + ".txt"

0 commit comments

Comments
 (0)