Fix: Test TestSafeWriteToDisk now works

Oops, my bad.
Despite the function intending to test SafeWriteToDisk it was actually
calling WriteToDisk. WriteToDisk does not return the file exists error
that SafeWriteToDisk does, which the test checks for.
This commit is contained in:
Owen Waller 2014-09-10 19:47:31 +01:00 committed by spf13
parent e8bbc44ab0
commit a54ad2bf39

View file

@ -457,7 +457,6 @@ func TestFindCWD(t *testing.T) {
} }
func TestSafeWriteToDisk(t *testing.T) { func TestSafeWriteToDisk(t *testing.T) {
/*
emptyFile, _ := createZeroSizedFileInTempDir() emptyFile, _ := createZeroSizedFileInTempDir()
defer deleteFileInTempDir(emptyFile) defer deleteFileInTempDir(emptyFile)
tmpDir, _ := createEmptyTempDir() tmpDir, _ := createEmptyTempDir()
@ -479,7 +478,7 @@ func TestSafeWriteToDisk(t *testing.T) {
} }
for i, d := range data { for i, d := range data {
e := WriteToDisk(d.filename, reader) e := SafeWriteToDisk(d.filename, reader)
t.Errorf("Failed: e is %q %#v", e, e) t.Errorf("Failed: e is %q %#v", e, e)
if d.expectedErr != nil { if d.expectedErr != nil {
if d.expectedErr.Error() != e.Error() { if d.expectedErr.Error() != e.Error() {
@ -494,7 +493,6 @@ func TestSafeWriteToDisk(t *testing.T) {
t.Errorf("Test %d failed. Expected contents %q but got %q", i, randomString, string(contents)) t.Errorf("Test %d failed. Expected contents %q but got %q", i, randomString, string(contents))
} }
} }
*/
} }
func TestWriteToDisk(t *testing.T) { func TestWriteToDisk(t *testing.T) {