(t *testing.T)
| 258 | } |
| 259 | |
| 260 | func TestPositionalSignature(t *testing.T) { |
| 261 | tests := []struct { |
| 262 | name string |
| 263 | use string |
| 264 | want string |
| 265 | }{ |
| 266 | {"two placeholders", "set <key> <value>", "<key> <value>"}, |
| 267 | {"flags marker is dropped", "rule [flags] <path...>", "<path...>"}, |
| 268 | {"inline enumeration is dropped", "completion [bash|zsh|fish]", ""}, |
| 269 | {"command name only", "version", ""}, |
| 270 | {"placeholder after flags marker", "show [flags] <session-id>", "<session-id>"}, |
| 271 | {"empty use", "", ""}, |
| 272 | } |
| 273 | |
| 274 | for _, tt := range tests { |
| 275 | t.Run(tt.name, func(t *testing.T) { |
| 276 | if got := positionalSignature(&cobra.Command{Use: tt.use}); got != tt.want { |
| 277 | t.Errorf("positionalSignature(%q) = %q, want %q", tt.use, got, tt.want) |
| 278 | } |
| 279 | }) |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | func TestValidArgNames(t *testing.T) { |
| 284 | tests := []struct { |
nothing calls this directly
no test coverage detected