Skip to content

Commit

Permalink
more test cases
Browse files Browse the repository at this point in the history
Signed-off-by: Sammy Oina <[email protected]>
  • Loading branch information
SammyOina committed Nov 18, 2024
1 parent 43d412c commit 6a2d064
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions internal/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand All @@ -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")
}
}

0 comments on commit 6a2d064

Please sign in to comment.