command: Fix TestRefresh_outPath

We now only create a backup state file if the given output file already
exists, which it does not in this test.

(The behavior of creating the backup files is already covered by other
tests, so no need for this one go out of its way to do it.)
This commit is contained in:
Martin Atkins 2018-11-16 16:09:25 -08:00
parent e2ba90fdfa
commit 762a173c7f
1 changed files with 5 additions and 5 deletions

View File

@ -343,11 +343,11 @@ func TestRefresh_outPath(t *testing.T) {
t.Fatalf("wrong new object\ngot: %swant: %s", spew.Sdump(actual), spew.Sdump(expected))
}
backupState := testStateRead(t, outPath+DefaultBackupExtension)
actualStr := strings.TrimSpace(backupState.String())
expectedStr := strings.TrimSpace(state.String())
if actualStr != expectedStr {
t.Fatalf("bad:\n\n%s\n\n%s", actualStr, expectedStr)
if _, err := os.Stat(outPath+DefaultBackupExtension); !os.IsNotExist(err) {
if err != nil {
t.Fatalf("failed to test for backup file: %s", err)
}
t.Fatalf("backup file exists, but it should not because output file did not initially exist")
}
}