Skip to content

Commit

Permalink
test: improve reliability of file operations
Browse files Browse the repository at this point in the history
- Add error handling after writing to a file in `local_file_test.go` test function

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
  • Loading branch information
appleboy committed Feb 17, 2024
1 parent acf41a9 commit e3221e7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion local_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ func TestLocalFile(t *testing.T) {
t.Error(err)
}
defer os.Remove(f.Name())
f.WriteString("Gin Web Framework")
_, err = f.WriteString("Gin Web Framework")
if err != nil {
t.Error(err)
}
f.Close()

dir, filename := filepath.Split(f.Name())
Expand Down

0 comments on commit e3221e7

Please sign in to comment.