mirror of
https://github.com/1f349/lotus.git
synced 2024-11-09 22:52:53 +00:00
28 lines
598 B
Go
28 lines
598 B
Go
package comma_list_scanner
|
|
|
|
import (
|
|
"github.com/stretchr/testify/assert"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
var testCommaList = []struct {
|
|
text string
|
|
out []string
|
|
}{
|
|
{"hello, wow this is cool, amazing", []string{"hello", "wow this is cool", "amazing"}},
|
|
{"hello, wow this is cool, amazing", []string{"hello", "wow this is cool", "amazing"}},
|
|
}
|
|
|
|
func TestNewCommaListScanner(t *testing.T) {
|
|
for _, i := range testCommaList {
|
|
t.Run(i.text, func(t *testing.T) {
|
|
s := NewCommaListScanner(strings.NewReader(i.text))
|
|
n := 0
|
|
for s.Scan() {
|
|
assert.Equal(t, i.out[n], s.Text())
|
|
}
|
|
})
|
|
}
|
|
}
|