Added more tests
This commit is contained in:
parent
bd0a468282
commit
f7bc903aa4
8 changed files with 20 additions and 7 deletions
|
@ -31,6 +31,10 @@ func (list List) LastIndexKind(kind Kind) int {
|
|||
|
||||
// Split calls the callback function on each set of tokens in a comma separated list.
|
||||
func (list List) Split(call func(List) error) error {
|
||||
if len(list) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
start := 0
|
||||
groupLevel := 0
|
||||
|
||||
|
@ -58,12 +62,8 @@ func (list List) Split(call func(List) error) error {
|
|||
}
|
||||
}
|
||||
|
||||
if start != len(list) {
|
||||
parameter := list[start:]
|
||||
return call(parameter)
|
||||
}
|
||||
|
||||
return nil
|
||||
parameter := list[start:]
|
||||
return call(parameter)
|
||||
}
|
||||
|
||||
// Text returns the concatenated token text.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue