23 lines
344 B
Go
23 lines
344 B
Go
package helpers
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func CreateFile(t *testing.T) *os.File {
|
|
f, err := os.CreateTemp("", "sample")
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
t.Logf("file is created: %s", f.Name())
|
|
return f
|
|
}
|
|
|
|
func FillFile(t *testing.T, f *os.File, content string) {
|
|
_, err := f.WriteString(content)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|