mirror of
https://github.com/ddworken/hishtory.git
synced 2024-11-22 16:24:00 +01:00
Fix error checking so that if /tmp/test-goldens/ exists, then we don't error out
This commit is contained in:
parent
f88e1d5b3b
commit
acdcd9569a
@ -370,7 +370,7 @@ func CompareGoldens(t testing.TB, out, goldenName string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if diff := cmp.Diff(string(expected), out); diff != "" {
|
if diff := cmp.Diff(string(expected), out); diff != "" {
|
||||||
if err := os.Mkdir("/tmp/test-goldens", os.ModePerm); err != nil {
|
if err := os.Mkdir("/tmp/test-goldens", os.ModePerm); err != nil && !os.IsExist(err) {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
require.NoError(t, os.WriteFile(path.Join("/tmp/test-goldens", goldenName), []byte(out), 0644))
|
require.NoError(t, os.WriteFile(path.Join("/tmp/test-goldens", goldenName), []byte(out), 0644))
|
||||||
|
Loading…
Reference in New Issue
Block a user