MCPcopy
hub / github.com/urfave/cli / TestArgsUsage

Function TestArgsUsage

args_test.go:445–508  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

443}
444
445func TestArgsUsage(t *testing.T) {
446 arg := &IntArgs{
447 Name: "ia",
448 Min: 0,
449 Max: 1,
450 }
451 tests := []struct {
452 name string
453 min int
454 max int
455 usage string
456 expected string
457 }{
458 {
459 name: "optional",
460 min: 0,
461 max: 1,
462 expected: "[ia]",
463 },
464 {
465 name: "optional",
466 min: 0,
467 max: 1,
468 usage: "[my optional usage]",
469 expected: "[my optional usage]",
470 },
471 {
472 name: "zero or more",
473 min: 0,
474 max: 2,
475 expected: "[ia ...]",
476 },
477 {
478 name: "one",
479 min: 1,
480 max: 1,
481 expected: "ia [ia ...]",
482 },
483 {
484 name: "many",
485 min: 2,
486 max: 1,
487 expected: "ia [ia ...]",
488 },
489 {
490 name: "many2",
491 min: 2,
492 max: 0,
493 expected: "ia [ia ...]",
494 },
495 {
496 name: "unlimited",
497 min: 2,
498 max: -1,
499 expected: "ia [ia ...]",
500 },
501 }
502 for _, test := range tests {

Callers

nothing calls this directly

Calls 2

UsageMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected