go-zero/core/iox/textfile_test.go
Kevin Wan d935c83a54
feat: support baggage propagation in httpc (#2375)
* feat: support baggage propagation in httpc

* chore: use go 1.16

* chore: use go 1.16

* chore: use go ^1.16

* chore: remove deprecated
2022-09-10 15:18:52 +08:00

27 lines
382 B
Go

package iox
import (
"os"
"testing"
"github.com/stretchr/testify/assert"
)
func TestCountLines(t *testing.T) {
const val = `1
2
3
4`
file, err := os.CreateTemp(os.TempDir(), "test-")
if err != nil {
t.Fatal(err)
}
defer os.Remove(file.Name())
file.WriteString(val)
file.Close()
lines, err := CountLines(file.Name())
assert.Nil(t, err)
assert.Equal(t, 4, lines)
}