(t *testing.T)
| 243 | } |
| 244 | |
| 245 | func TestPositionalSignature(t *testing.T) { |
| 246 | tests := []struct { |
| 247 | name string |
| 248 | use string |
| 249 | want string |
| 250 | }{ |
| 251 | {"two placeholders", "set <key> <value>", "<key> <value>"}, |
| 252 | {"flags marker is dropped", "rule [flags] <path...>", "<path...>"}, |
| 253 | {"inline enumeration is dropped", "completion [bash|zsh|fish]", ""}, |
| 254 | {"command name only", "version", ""}, |
| 255 | {"placeholder after flags marker", "show [flags] <session-id>", "<session-id>"}, |
| 256 | {"empty use", "", ""}, |
| 257 | } |
| 258 | |
| 259 | for _, tt := range tests { |
| 260 | t.Run(tt.name, func(t *testing.T) { |
| 261 | if got := positionalSignature(&cobra.Command{Use: tt.use}); got != tt.want { |
| 262 | t.Errorf("positionalSignature(%q) = %q, want %q", tt.use, got, tt.want) |
| 263 | } |
| 264 | }) |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | func TestValidArgNames(t *testing.T) { |
| 269 | tests := []struct { |
nothing calls this directly
no test coverage detected