MCPcopy Create free account
hub / github.com/alibaba/open-code-review / TestPositionalSignature

Function TestPositionalSignature

cmd/opencodereview/arg_errors_test.go:245–266  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

243}
244
245func 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
268func TestValidArgNames(t *testing.T) {
269 tests := []struct {

Callers

nothing calls this directly

Calls 2

positionalSignatureFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected