(t *testing.T)
| 1933 | } |
| 1934 | |
| 1935 | func TestEnableCommandSortingIsDisabled(t *testing.T) { |
| 1936 | EnableCommandSorting = false |
| 1937 | |
| 1938 | originalNames := []string{"middle", "zlast", "afirst"} |
| 1939 | |
| 1940 | var rootCmd = &Command{Use: "root"} |
| 1941 | |
| 1942 | for _, name := range originalNames { |
| 1943 | rootCmd.AddCommand(&Command{Use: name}) |
| 1944 | } |
| 1945 | |
| 1946 | for i, c := range rootCmd.Commands() { |
| 1947 | got := c.Name() |
| 1948 | if originalNames[i] != got { |
| 1949 | t.Errorf("expected: %s, got: %s", originalNames[i], got) |
| 1950 | } |
| 1951 | } |
| 1952 | |
| 1953 | EnableCommandSorting = defaultCommandSorting |
| 1954 | } |
| 1955 | |
| 1956 | func TestUsageWithGroup(t *testing.T) { |
| 1957 | var rootCmd = &Command{Use: "root", Short: "test", Run: emptyRun} |
nothing calls this directly
no test coverage detected