diff --git a/internal/file_test.go b/internal/file_test.go index f36e8207..0a9839d1 100644 --- a/internal/file_test.go +++ b/internal/file_test.go @@ -38,6 +38,13 @@ func TestCopyFile(t *testing.T) { } } +func TestCopyFile_NonExistentSource(t *testing.T) { + err := CopyFile("nonexistent.txt", "destination.txt") + if err == nil { + t.Error("CopyFile did not return an error for a nonexistent source file") + } +} + func TestDeleteFilesInDir(t *testing.T) { tempDir, err := os.MkdirTemp("", "deletefiles_test") if err != nil { @@ -111,6 +118,13 @@ func TestChecksum(t *testing.T) { } } +func TestChecksum_NonExistentFile(t *testing.T) { + _, err := Checksum("nonexistent.txt") + if err == nil { + t.Error("Checksum did not return an error for a nonexistent file") + } +} + func TestChecksumHex(t *testing.T) { tempFile, err := os.CreateTemp("", "checksumhex_test") if err != nil { @@ -134,3 +148,10 @@ func TestChecksumHex(t *testing.T) { t.Errorf("ChecksumHex mismatch. Got %s, want %s", checksumHex, expectedChecksumHex) } } + +func TestChecksumHex_NonExistentFile(t *testing.T) { + _, err := ChecksumHex("nonexistent.txt") + if err == nil { + t.Error("ChecksumHex did not return an error for a nonexistent file") + } +}