Files
kong/model_test.go
T
Alec Thomas a2ec050947 Implement a robust Context.Run().
This helps when composing large applications from separate command
structs.
2018-06-21 21:50:30 +10:00

28 lines
517 B
Go

package kong_test
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestModelApplicationCommands(t *testing.T) {
var cli struct {
One struct {
Two struct {
} `kong:"cmd"`
Three struct {
Four struct {
Four string `kong:"arg"`
} `kong:"arg"`
} `kong:"cmd"`
} `kong:"cmd"`
}
p := mustNew(t, &cli)
actual := []string{}
for _, cmd := range p.Model.Leaves() {
actual = append(actual, cmd.Path())
}
require.Equal(t, []string{"one two", "one three <four>"}, actual)
}