(t *testing.T)
| 92 | } |
| 93 | |
| 94 | func TestExcludeFlagCommaHandling(t *testing.T) { |
| 95 | // Reset global state. |
| 96 | included = nil |
| 97 | excluded = nil |
| 98 | gConfig = &config2.BugReportConfig{} |
| 99 | |
| 100 | cmd := &cobra.Command{Use: "test"} |
| 101 | addFlags(cmd, gConfig) |
| 102 | args := []string{"--exclude", "my-app-ns,my-other-ns"} |
| 103 | if err := cmd.ParseFlags(args); err != nil { |
| 104 | t.Fatal(err) |
| 105 | } |
| 106 | |
| 107 | config, err := parseConfig() |
| 108 | if err != nil { |
| 109 | t.Fatal(err) |
| 110 | } |
| 111 | |
| 112 | // The first exclude entry is the default (IgnoredNamespaces). |
| 113 | // The second should be our flag value with both namespaces together. |
| 114 | if len(config.Exclude) < 2 { |
| 115 | t.Fatalf("expected at least 2 exclude specs, got %d", len(config.Exclude)) |
| 116 | } |
| 117 | assert.Equal(t, config.Exclude[1].Namespaces, []string{"my-app-ns", "my-other-ns"}) |
| 118 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…