mirror of
https://github.com/rclone/rclone.git
synced 2024-12-12 20:33:50 +08:00
29 lines
642 B
Go
29 lines
642 B
Go
package ftp
|
|
|
|
import "testing"
|
|
import "github.com/stretchr/testify/assert"
|
|
|
|
func TestScanner(t *testing.T) {
|
|
assert := assert.New(t)
|
|
|
|
s := newScanner("foo bar x y")
|
|
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)
|
|
|
|
s := newScanner("")
|
|
assert.Equal("", s.Next())
|
|
assert.Equal("", s.Next())
|
|
assert.Equal("", s.Remaining())
|
|
}
|