1d00dfef7b
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.
27 lines
672 B
Go
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)
|
|
}
|