File: model_test.go

package info (click to toggle)
golang-github-alecthomas-kong 0.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 620 kB
  • sloc: makefile: 2
file content (27 lines) | stat: -rw-r--r-- 522 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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(false) {
		actual = append(actual, cmd.Path())
	}
	require.Equal(t, []string{"one two", "one three <four>"}, actual)
}