2016-12-31 17:32:31 +01:00
|
|
|
package ftp
|
|
|
|
|
2021-03-07 01:44:19 +01:00
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
2016-12-31 17:32:31 +01:00
|
|
|
|
|
|
|
func TestScanner(t *testing.T) {
|
|
|
|
assert := assert.New(t)
|
|
|
|
|
2017-03-04 13:01:41 +01:00
|
|
|
s := newScanner("foo bar x y")
|
2016-12-31 17:32:31 +01:00
|
|
|
assert.Equal("foo", s.Next())
|
|
|
|
assert.Equal(" bar x y", s.Remaining())
|
|
|
|
assert.Equal("bar", s.Next())
|
|
|
|
assert.Equal("x y", s.Remaining())
|
|
|
|
assert.Equal("x", s.Next())
|
|
|
|
assert.Equal(" y", s.Remaining())
|
|
|
|
assert.Equal("y", s.Next())
|
|
|
|
assert.Equal("", s.Next())
|
|
|
|
assert.Equal("", s.Remaining())
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestScannerEmpty(t *testing.T) {
|
|
|
|
assert := assert.New(t)
|
|
|
|
|
2017-03-04 13:01:41 +01:00
|
|
|
s := newScanner("")
|
2016-12-31 17:32:31 +01:00
|
|
|
assert.Equal("", s.Next())
|
|
|
|
assert.Equal("", s.Next())
|
|
|
|
assert.Equal("", s.Remaining())
|
|
|
|
}
|