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

Function TestPositionalSignature

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

Source from the content-addressed store, hash-verified

258}
259
260func 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
283func TestValidArgNames(t *testing.T) {
284 tests := []struct {

Callers

nothing calls this directly

Calls 2

positionalSignatureFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected