(t *testing.T)
| 31 | ) |
| 32 | |
| 33 | func TestNormalizationFuncGlobalExistence(t *testing.T) { |
| 34 | // This test can be safely deleted when we will not support multiple flag formats |
| 35 | root := NewKubectlCommand(KubectlOptions{IOStreams: genericiooptions.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr}}) |
| 36 | |
| 37 | if root.Parent() != nil { |
| 38 | t.Fatal("We expect the root command to be returned") |
| 39 | } |
| 40 | if root.GlobalNormalizationFunc() == nil { |
| 41 | t.Fatal("We expect that root command has a global normalization function") |
| 42 | } |
| 43 | |
| 44 | if reflect.ValueOf(root.GlobalNormalizationFunc()).Pointer() != reflect.ValueOf(root.Flags().GetNormalizeFunc()).Pointer() { |
| 45 | t.Fatal("root command seems to have a wrong normalization function") |
| 46 | } |
| 47 | |
| 48 | sub := root |
| 49 | for sub.HasSubCommands() { |
| 50 | sub = sub.Commands()[0] |
| 51 | } |
| 52 | |
| 53 | // In case of failure of this test check this PR: spf13/cobra#110 |
| 54 | if reflect.ValueOf(sub.Flags().GetNormalizeFunc()).Pointer() != reflect.ValueOf(root.Flags().GetNormalizeFunc()).Pointer() { |
| 55 | t.Fatal("child and root commands should have the same normalization functions") |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | func TestKubectlSubcommandShadowPlugin(t *testing.T) { |
| 60 | tests := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…