Files
kong/scanner_test.go
T
Alec Thomas 1d00dfef7b Implemented most of the base parser.
This includes branching arguments as well as commands, eg.

    app user create <id> <first> <last>
    app user <id> delete
    app user <id> rename <to>

Of note, required/optional flags and positional arguments are not
currently enforced.
2018-05-16 20:33:18 +10:00

27 lines
672 B
Go

package kong
import (
"testing"
"github.com/gotestyourself/gotestyourself/assert"
)
func TestScannerTake(t *testing.T) {
s := Scan("a", "b", "c")
assert.Assert(t, s.Pop().Value == "a")
assert.Assert(t, s.Pop().Value == "b")
assert.Assert(t, s.Pop().Value == "c")
assert.Assert(t, s.Pop().Type == EOLToken)
}
func TestScannerPeek(t *testing.T) {
s := Scan("a", "b", "c")
assert.Assert(t, s.Peek().Value == "a")
assert.Assert(t, s.Pop().Value == "a")
assert.Assert(t, s.Peek().Value == "b")
assert.Assert(t, s.Pop().Value == "b")
assert.Assert(t, s.Peek().Value == "c")
assert.Assert(t, s.Pop().Value == "c")
assert.Assert(t, s.Peek().Type == EOLToken)
}