Skip to content

Commit

Permalink
Improve test code
Browse files Browse the repository at this point in the history
  • Loading branch information
hahwul committed Apr 26, 2022
1 parent 878003f commit 8f2f3ed
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions pkg/gee/file_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package gee

import (
"os"
"testing"

model "github.com/hahwul/gee/pkg/model"
)

func TestWriteFile(t *testing.T) {
type args struct {
line string
options model.Options
}
tests := []struct {
name string
args args
}{
{
name: "test removeNewLine",
args: args{
line: "1111",
options: model.Options{
RemoveNewLine: true,
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
k, _ := os.OpenFile("gee_testcode_testfile.txt", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
WriteFile(k, tt.args.line, tt.args.options)
os.Remove("gee_testcode_testfile.txt")
})
}
}

0 comments on commit 8f2f3ed

Please sign in to comment.