|
|
@ -3,6 +3,7 @@ package iox
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
|
"testing"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"testing/iotest"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -22,3 +23,10 @@ func TestScanner(t *testing.T) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
assert.EqualValues(t, []string{"1", "2", "3", "4"}, lines)
|
|
|
|
assert.EqualValues(t, []string{"1", "2", "3", "4"}, lines)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func TestBadScanner(t *testing.T) {
|
|
|
|
|
|
|
|
scanner := NewTextLineScanner(iotest.ErrReader(iotest.ErrTimeout))
|
|
|
|
|
|
|
|
assert.False(t, scanner.Scan())
|
|
|
|
|
|
|
|
_, err := scanner.Line()
|
|
|
|
|
|
|
|
assert.ErrorIs(t, err, iotest.ErrTimeout)
|
|
|
|
|
|
|
|
}
|
|
|
|