(t *testing.T)
| 38 | } |
| 39 | |
| 40 | func TestInvalidPlugin(t *testing.T) { |
| 41 | root := &cobra.Command{Use: "root"} |
| 42 | sub1 := &cobra.Command{Use: "sub1"} |
| 43 | sub1sub1 := &cobra.Command{Use: "sub1sub1"} |
| 44 | sub1sub2 := &cobra.Command{Use: "sub1sub2"} |
| 45 | sub2 := &cobra.Command{Use: "sub2"} |
| 46 | |
| 47 | assert.Assert(t, is.Len(invalidPlugins(root), 0)) |
| 48 | |
| 49 | sub1.Annotations = map[string]string{ |
| 50 | metadata.CommandAnnotationPlugin: "true", |
| 51 | metadata.CommandAnnotationPluginInvalid: "foo", |
| 52 | } |
| 53 | root.AddCommand(sub1, sub2) |
| 54 | sub1.AddCommand(sub1sub1, sub1sub2) |
| 55 | |
| 56 | assert.DeepEqual(t, invalidPlugins(root), []*cobra.Command{sub1}, cmpopts.IgnoreUnexported(cobra.Command{})) |
| 57 | } |
| 58 | |
| 59 | func TestHiddenPlugin(t *testing.T) { |
| 60 | root := &cobra.Command{Use: "root"} |
nothing calls this directly
no test coverage detected
searching dependent graphs…