Skip to content

Commit 8f2f3ed

Browse files
committed
Improve test code
1 parent 878003f commit 8f2f3ed

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

pkg/gee/file_test.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package gee
2+
3+
import (
4+
"os"
5+
"testing"
6+
7+
model "github.com/hahwul/gee/pkg/model"
8+
)
9+
10+
func TestWriteFile(t *testing.T) {
11+
type args struct {
12+
line string
13+
options model.Options
14+
}
15+
tests := []struct {
16+
name string
17+
args args
18+
}{
19+
{
20+
name: "test removeNewLine",
21+
args: args{
22+
line: "1111",
23+
options: model.Options{
24+
RemoveNewLine: true,
25+
},
26+
},
27+
},
28+
}
29+
for _, tt := range tests {
30+
t.Run(tt.name, func(t *testing.T) {
31+
k, _ := os.OpenFile("gee_testcode_testfile.txt", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
32+
WriteFile(k, tt.args.line, tt.args.options)
33+
os.Remove("gee_testcode_testfile.txt")
34+
})
35+
}
36+
}

0 commit comments

Comments
 (0)