| 1 | package cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ |
| 2 | |
| 3 | import ( |
| 4 | "contextscip-go gomod github.com/golang/go/src go1.22 context/" |
| 5 | "testingscip-go gomod github.com/golang/go/src go1.22 testing/" |
| 6 | "timescip-go gomod github.com/golang/go/src go1.22 time/" |
| 7 | |
| 8 | "github.com/stretchr/testify/requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/" |
| 9 | ) |
| 10 | |
| 11 | func TestArgNotSetscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestArgNotSet().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 12 | arg := &StringArgscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringArg#{ |
| 13 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentBase#Name.: "sa", |
| 14 | Valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentBase#Value.: "foo", |
| 15 | } |
| 16 | |
| 17 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Equal().(t, "foo", arg.Getscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentBase#Get().()) |
| 18 | } |
| 19 | |
| 20 | func TestArgsMaxNotSetscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestArgsMaxNotSet().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 21 | arg := &StringArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringArgs#{ |
| 22 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Name.: "sa", |
| 23 | Valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Value.: "foo", |
| 24 | } |
| 25 | |
| 26 | cmd := buildMinimalTestCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildMinimalTestCommand().() |
| 27 | cmd.Argumentsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Arguments. = []Argumentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Argument#{arg} |
| 28 | |
| 29 | err := cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "bar"}) |
| 30 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.ErrorContainsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/ErrorContains().(t, err, "args sa has max 0, not parsing argument") |
| 31 | } |
| 32 | |
| 33 | func TestArgsMinGtMaxscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestArgsMinGtMax().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 34 | arg := &StringArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringArgs#{ |
| 35 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Name.: "sa", |
| 36 | Valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Value.: "foo", |
| 37 | Minscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Min.: 2, |
| 38 | Maxscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Max.: 1, |
| 39 | } |
| 40 | |
| 41 | cmd := buildMinimalTestCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildMinimalTestCommand().() |
| 42 | cmd.Argumentsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Arguments. = []Argumentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Argument#{arg} |
| 43 | |
| 44 | err := cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "bar"}) |
| 45 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.ErrorContainsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/ErrorContains().(t, err, "args sa has min[2] > max[1], not parsing argument") |
| 46 | } |
| 47 | |
| 48 | func TestArgsFloatTypesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestArgsFloatTypes().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 49 | cmd := buildMinimalTestCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildMinimalTestCommand().() |
| 50 | var fval float64 |
| 51 | cmd.Argumentsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Arguments. = []Argumentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Argument#{ |
| 52 | &FloatArgscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FloatArg#{ |
| 53 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentBase#Name.: "ia", |
| 54 | Destinationscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentBase#Destination.: &fval, |
| 55 | }, |
| 56 | } |
| 57 | |
| 58 | err := cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "10"}) |
| 59 | r := requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Newscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/New().(t) |
| 60 | r.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#NoError().(err) |
| 61 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(float64(10), fval) |
| 62 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(float64(10), cmd.FloatArgscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#FloatArg().("ia")) |
| 63 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(float64(10), cmd.Float64Argscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Float64Arg().("ia")) |
| 64 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(float32(0), cmd.Float32Argscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Float32Arg().("ia")) |
| 65 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(float64(0), cmd.FloatArgscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#FloatArg().("iab")) |
| 66 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(int8(0), cmd.Int8Argscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Int8Arg().("ia")) |
| 67 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(int16(0), cmd.Int16Argscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Int16Arg().("ia")) |
| 68 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(int32(0), cmd.Int32Argscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Int32Arg().("ia")) |
| 69 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(int64(0), cmd.Int64Argscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Int64Arg().("ia")) |
| 70 | r.Emptyscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Empty().(cmd.StringArgscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#StringArg().("ia")) |
| 71 | |
| 72 | r.Errorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Error().(cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "a"})) |
| 73 | } |
| 74 | |
| 75 | func TestArgsIntTypesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestArgsIntTypes().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 76 | cmd := buildMinimalTestCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildMinimalTestCommand().() |
| 77 | var ival int |
| 78 | cmd.Argumentsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Arguments. = []Argumentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Argument#{ |
| 79 | &IntArgscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/IntArg#{ |
| 80 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentBase#Name.: "ia", |
| 81 | Destinationscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentBase#Destination.: &ival, |
| 82 | }, |
| 83 | } |
| 84 | |
| 85 | err := cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "10"}) |
| 86 | r := requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Newscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/New().(t) |
| 87 | r.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#NoError().(err) |
| 88 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(10, ival) |
| 89 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(10, cmd.IntArgscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#IntArg().("ia")) |
| 90 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(0, cmd.IntArgscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#IntArg().("iab")) |
| 91 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(int8(0), cmd.Int8Argscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Int8Arg().("ia")) |
| 92 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(int16(0), cmd.Int16Argscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Int16Arg().("ia")) |
| 93 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(int32(0), cmd.Int32Argscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Int32Arg().("ia")) |
| 94 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(int64(0), cmd.Int64Argscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Int64Arg().("ia")) |
| 95 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(float64(0), cmd.FloatArgscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#FloatArg().("ia")) |
| 96 | r.Emptyscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Empty().(cmd.StringArgscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#StringArg().("ia")) |
| 97 | |
| 98 | r.Errorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Error().(cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "10.0"})) |
| 99 | } |
| 100 | |
| 101 | func TestArgsFloatSliceTypesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestArgsFloatSliceTypes().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 102 | cmd := buildMinimalTestCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildMinimalTestCommand().() |
| 103 | var fval []float64 |
| 104 | cmd.Argumentsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Arguments. = []Argumentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Argument#{ |
| 105 | &FloatArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FloatArgs#{ |
| 106 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Name.: "ia", |
| 107 | Minscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Min.: 1, |
| 108 | Maxscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Max.: -1, |
| 109 | Destinationscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Destination.: &fval, |
| 110 | }, |
| 111 | } |
| 112 | |
| 113 | err := cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "10", "20", "30"}) |
| 114 | r := requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Newscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/New().(t) |
| 115 | r.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#NoError().(err) |
| 116 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().([]float64{10, 20, 30}, fval) |
| 117 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().([]float64{10, 20, 30}, cmd.FloatArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#FloatArgs().("ia")) |
| 118 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().([]float64{10, 20, 30}, cmd.Float64Argsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Float64Args().("ia")) |
| 119 | r.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Nil().(cmd.Float32Argsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Float32Args().("ia")) |
| 120 | |
| 121 | r.Errorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Error().(cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "10", "a"})) |
| 122 | } |
| 123 | |
| 124 | func TestArgsIntSliceTypesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestArgsIntSliceTypes().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 125 | cmd := buildMinimalTestCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildMinimalTestCommand().() |
| 126 | var ival []int |
| 127 | cmd.Argumentsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Arguments. = []Argumentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Argument#{ |
| 128 | &IntArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/IntArgs#{ |
| 129 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Name.: "ia", |
| 130 | Minscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Min.: 1, |
| 131 | Maxscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Max.: -1, |
| 132 | Destinationscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Destination.: &ival, |
| 133 | }, |
| 134 | } |
| 135 | |
| 136 | err := cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "10", "20", "30"}) |
| 137 | r := requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Newscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/New().(t) |
| 138 | r.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#NoError().(err) |
| 139 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().([]int{10, 20, 30}, ival) |
| 140 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().([]int{10, 20, 30}, cmd.IntArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#IntArgs().("ia")) |
| 141 | r.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Nil().(cmd.Int8Argsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Int8Args().("ia")) |
| 142 | r.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Nil().(cmd.Int16Argsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Int16Args().("ia")) |
| 143 | r.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Nil().(cmd.Int32Argsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Int32Args().("ia")) |
| 144 | r.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Nil().(cmd.Int64Argsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Int64Args().("ia")) |
| 145 | |
| 146 | r.Errorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Error().(cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "10", "20.0"})) |
| 147 | } |
| 148 | |
| 149 | func TestArgsUintTypesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestArgsUintTypes().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 150 | cmd := buildMinimalTestCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildMinimalTestCommand().() |
| 151 | var ival uint |
| 152 | cmd.Argumentsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Arguments. = []Argumentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Argument#{ |
| 153 | &UintArgscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/UintArg#{ |
| 154 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentBase#Name.: "ia", |
| 155 | Destinationscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentBase#Destination.: &ival, |
| 156 | }, |
| 157 | } |
| 158 | |
| 159 | err := cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "10"}) |
| 160 | r := requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Newscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/New().(t) |
| 161 | r.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#NoError().(err) |
| 162 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(uint(10), ival) |
| 163 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(uint(10), cmd.UintArgscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#UintArg().("ia")) |
| 164 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(uint(0), cmd.UintArgscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#UintArg().("iab")) |
| 165 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(uint8(0), cmd.Uint8Argscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Uint8Arg().("ia")) |
| 166 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(uint16(0), cmd.Uint16Argscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Uint16Arg().("ia")) |
| 167 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(uint32(0), cmd.Uint32Argscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Uint32Arg().("ia")) |
| 168 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(uint64(0), cmd.Uint64Argscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Uint64Arg().("ia")) |
| 169 | |
| 170 | r.Errorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Error().(cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "10.0"})) |
| 171 | } |
| 172 | |
| 173 | func TestArgsUintSliceTypesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestArgsUintSliceTypes().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 174 | cmd := buildMinimalTestCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildMinimalTestCommand().() |
| 175 | var ival []uint |
| 176 | cmd.Argumentsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Arguments. = []Argumentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Argument#{ |
| 177 | &UintArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/UintArgs#{ |
| 178 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Name.: "ia", |
| 179 | Minscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Min.: 1, |
| 180 | Maxscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Max.: -1, |
| 181 | Destinationscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Destination.: &ival, |
| 182 | }, |
| 183 | } |
| 184 | |
| 185 | err := cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "10", "20", "30"}) |
| 186 | r := requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Newscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/New().(t) |
| 187 | r.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#NoError().(err) |
| 188 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().([]uint{10, 20, 30}, ival) |
| 189 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().([]uint{10, 20, 30}, cmd.UintArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#UintArgs().("ia")) |
| 190 | r.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Nil().(cmd.Uint8Argsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Uint8Args().("ia")) |
| 191 | r.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Nil().(cmd.Uint16Argsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Uint16Args().("ia")) |
| 192 | r.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Nil().(cmd.Uint32Argsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Uint32Args().("ia")) |
| 193 | r.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Nil().(cmd.Uint64Argsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Uint64Args().("ia")) |
| 194 | |
| 195 | r.Errorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Error().(cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "10", "20.0"})) |
| 196 | } |
| 197 | |
| 198 | func TestArgumentsRootCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestArgumentsRootCommand().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 199 | tests := []struct { |
| 200 | name string |
| 201 | args []string |
| 202 | expectedIvals []int |
| 203 | expectedUivals []uint |
| 204 | expectedFvals []float64 |
| 205 | errStr string |
| 206 | }{ |
| 207 | { |
| 208 | name: "set ival", |
| 209 | args: []string{"foo", "10"}, |
| 210 | expectedIvals: []int{10}, |
| 211 | expectedUivals: []uint{}, |
| 212 | expectedFvals: []float64{}, |
| 213 | }, |
| 214 | { |
| 215 | name: "set invalid ival", |
| 216 | args: []string{"foo", "10.0"}, |
| 217 | expectedIvals: []int{}, |
| 218 | expectedUivals: []uint{}, |
| 219 | expectedFvals: []float64{}, |
| 220 | errStr: "strconv.ParseInt: parsing \"10.0\": invalid syntax", |
| 221 | }, |
| 222 | { |
| 223 | name: "set ival uival", |
| 224 | args: []string{"foo", "-10", "11"}, |
| 225 | expectedIvals: []int{-10}, |
| 226 | expectedUivals: []uint{11}, |
| 227 | expectedFvals: []float64{}, |
| 228 | }, |
| 229 | { |
| 230 | name: "set ival uival fval", |
| 231 | args: []string{"foo", "-12", "14", "10.1"}, |
| 232 | expectedIvals: []int{-12}, |
| 233 | expectedUivals: []uint{14}, |
| 234 | expectedFvals: []float64{10.1}, |
| 235 | }, |
| 236 | { |
| 237 | name: "set ival uival multu fvals", |
| 238 | args: []string{"foo", "-13", "12", "10.1", "11.09"}, |
| 239 | expectedIvals: []int{-13}, |
| 240 | expectedUivals: []uint{12}, |
| 241 | expectedFvals: []float64{10.1, 11.09}, |
| 242 | }, |
| 243 | { |
| 244 | name: "set fvals beyond max", |
| 245 | args: []string{"foo", "13", "10", "10.1", "11.09", "12.1"}, |
| 246 | expectedIvals: []int{13}, |
| 247 | expectedUivals: []uint{10}, |
| 248 | expectedFvals: []float64{10.1, 11.09}, |
| 249 | errStr: "No help topic for '12.1'", |
| 250 | }, |
| 251 | } |
| 252 | |
| 253 | for _, test := range tests { |
| 254 | t.Runscip-go gomod github.com/golang/go/src go1.22 testing/T#Run().(test.name, func(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 255 | cmd := buildMinimalTestCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildMinimalTestCommand().() |
| 256 | var ivals []int |
| 257 | var uivals []uint |
| 258 | var fvals []float64 |
| 259 | cmd.Argumentsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Arguments. = []Argumentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Argument#{ |
| 260 | &IntArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/IntArgs#{ |
| 261 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Name.: "ia", |
| 262 | Minscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Min.: 1, |
| 263 | Maxscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Max.: 1, |
| 264 | Destinationscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Destination.: &ivals, |
| 265 | }, |
| 266 | &UintArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/UintArgs#{ |
| 267 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Name.: "uia", |
| 268 | Minscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Min.: 1, |
| 269 | Maxscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Max.: 1, |
| 270 | Destinationscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Destination.: &uivals, |
| 271 | }, |
| 272 | &FloatArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FloatArgs#{ |
| 273 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Name.: "fa", |
| 274 | Minscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Min.: 0, |
| 275 | Maxscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Max.: 2, |
| 276 | Destinationscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Destination.: &fvals, |
| 277 | }, |
| 278 | } |
| 279 | |
| 280 | err := cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), test.args) |
| 281 | |
| 282 | r := requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Newscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/New().(t) |
| 283 | |
| 284 | if test.errStr != "" { |
| 285 | r.ErrorContainsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#ErrorContains().(err, test.errStr) |
| 286 | } else { |
| 287 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(test.expectedIvals, ivals) |
| 288 | } |
| 289 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(test.expectedIvals, cmd.IntArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#IntArgs().("ia")) |
| 290 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(test.expectedFvals, cmd.FloatArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#FloatArgs().("fa")) |
| 291 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(test.expectedUivals, cmd.UintArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#UintArgs().("uia")) |
| 292 | /*if test.expectedFvals != nil { |
| 293 | r.Equal(test.expectedFvals, fvals) |
| 294 | }*/ |
| 295 | }) |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | func TestArgumentsInvalidTypescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestArgumentsInvalidType().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 300 | cmd := buildMinimalTestCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildMinimalTestCommand().() |
| 301 | cmd.Argumentsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Arguments. = []Argumentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Argument#{ |
| 302 | &IntArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/IntArgs#{ |
| 303 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Name.: "ia", |
| 304 | Minscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Min.: 1, |
| 305 | Maxscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Max.: 1, |
| 306 | }, |
| 307 | } |
| 308 | r := requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Newscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/New().(t) |
| 309 | r.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Nil().(cmd.StringArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#StringArgs().("ia")) |
| 310 | r.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Nil().(cmd.FloatArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#FloatArgs().("ia")) |
| 311 | r.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Nil().(cmd.Int8Argsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Int8Args().("ia")) |
| 312 | r.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Nil().(cmd.Int16Argsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Int16Args().("ia")) |
| 313 | r.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Nil().(cmd.Int32Argsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Int32Args().("ia")) |
| 314 | r.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Nil().(cmd.Int64Argsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Int64Args().("ia")) |
| 315 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(timescip-go gomod github.com/golang/go/src go1.22 time/.Timescip-go gomod github.com/golang/go/src go1.22 time/Time#{}, cmd.TimestampArgscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#TimestampArg().("ia")) |
| 316 | r.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Nil().(cmd.TimestampArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#TimestampArgs().("ia")) |
| 317 | r.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Nil().(cmd.UintArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#UintArgs().("ia")) |
| 318 | r.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Nil().(cmd.Uint8Argsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Uint8Args().("ia")) |
| 319 | r.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Nil().(cmd.Uint16Argsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Uint16Args().("ia")) |
| 320 | r.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Nil().(cmd.Uint32Argsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Uint32Args().("ia")) |
| 321 | r.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Nil().(cmd.Uint64Argsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Uint64Args().("ia")) |
| 322 | } |
| 323 | |
| 324 | func TestArgumentsSubcommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestArgumentsSubcommand().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 325 | tests := []struct { |
| 326 | name string |
| 327 | args []string |
| 328 | expectedIval int |
| 329 | expectedSvals []string |
| 330 | expectedTVals []timescip-go gomod github.com/golang/go/src go1.22 time/.Timescip-go gomod github.com/golang/go/src go1.22 time/Time# |
| 331 | errStr string |
| 332 | }{ |
| 333 | { |
| 334 | name: "insuff args", |
| 335 | args: []string{"foo", "subcmd", "2006-01-02T15:04:05Z"}, |
| 336 | errStr: "sufficient count of arg sa not provided, given 0 expected 1", |
| 337 | }, |
| 338 | { |
| 339 | name: "set sval and tval", |
| 340 | args: []string{"foo", "subcmd", "2006-01-02T15:04:05Z", "fubar"}, |
| 341 | expectedIval: 10, |
| 342 | expectedTVals: []timescip-go gomod github.com/golang/go/src go1.22 time/.Timescip-go gomod github.com/golang/go/src go1.22 time/Time#{timescip-go gomod github.com/golang/go/src go1.22 time/.Datescip-go gomod github.com/golang/go/src go1.22 time/Date().(2006, timescip-go gomod github.com/golang/go/src go1.22 time/.Januaryscip-go gomod github.com/golang/go/src go1.22 time/January., 2, 15, 4, 5, 0, timescip-go gomod github.com/golang/go/src go1.22 time/.UTCscip-go gomod github.com/golang/go/src go1.22 time/UTC.)}, |
| 343 | expectedSvals: []string{"fubar"}, |
| 344 | }, |
| 345 | { |
| 346 | name: "set sval, tval and ival", |
| 347 | args: []string{"foo", "subcmd", "--foo", "100", "2006-01-02T15:04:05Z", "fubar", "some"}, |
| 348 | expectedIval: 100, |
| 349 | expectedTVals: []timescip-go gomod github.com/golang/go/src go1.22 time/.Timescip-go gomod github.com/golang/go/src go1.22 time/Time#{timescip-go gomod github.com/golang/go/src go1.22 time/.Datescip-go gomod github.com/golang/go/src go1.22 time/Date().(2006, timescip-go gomod github.com/golang/go/src go1.22 time/.Januaryscip-go gomod github.com/golang/go/src go1.22 time/January., 2, 15, 4, 5, 0, timescip-go gomod github.com/golang/go/src go1.22 time/.UTCscip-go gomod github.com/golang/go/src go1.22 time/UTC.)}, |
| 350 | expectedSvals: []string{"fubar", "some"}, |
| 351 | }, |
| 352 | } |
| 353 | |
| 354 | for _, test := range tests { |
| 355 | t.Runscip-go gomod github.com/golang/go/src go1.22 testing/T#Run().(test.name, func(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 356 | cmd := buildMinimalTestCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildMinimalTestCommand().() |
| 357 | var ival int |
| 358 | var svals []string |
| 359 | var tvals []timescip-go gomod github.com/golang/go/src go1.22 time/.Timescip-go gomod github.com/golang/go/src go1.22 time/Time# |
| 360 | cmd.Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands. = []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 361 | { |
| 362 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "subcmd", |
| 363 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 364 | &IntFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/IntFlag#{ |
| 365 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "foo", |
| 366 | Valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Value.: 10, |
| 367 | Destinationscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Destination.: &ival, |
| 368 | }, |
| 369 | }, |
| 370 | Argumentsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Arguments.: []Argumentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Argument#{ |
| 371 | &TimestampArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TimestampArgs#{ |
| 372 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Name.: "ta", |
| 373 | Minscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Min.: 1, |
| 374 | Maxscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Max.: 1, |
| 375 | Destinationscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Destination.: &tvals, |
| 376 | Configscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Config.: TimestampConfigscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TimestampConfig#{ |
| 377 | Layoutsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TimestampConfig#Layouts.: []string{timescip-go gomod github.com/golang/go/src go1.22 time/.RFC3339scip-go gomod github.com/golang/go/src go1.22 time/RFC3339.}, |
| 378 | }, |
| 379 | }, |
| 380 | &StringArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringArgs#{ |
| 381 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Name.: "sa", |
| 382 | Minscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Min.: 1, |
| 383 | Maxscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Max.: 3, |
| 384 | Destinationscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Destination.: &svals, |
| 385 | }, |
| 386 | }, |
| 387 | }, |
| 388 | } |
| 389 | |
| 390 | numUsageErrors := 0 |
| 391 | cmd.Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.[0].OnUsageErrorscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#OnUsageError. = func(ctx contextscip-go gomod github.com/golang/go/src go1.22 context/.Contextscip-go gomod github.com/golang/go/src go1.22 context/Context#, cmd *Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#, err error, isSubcommand bool) error { |
| 392 | numUsageErrors++ |
| 393 | return err |
| 394 | } |
| 395 | |
| 396 | err := cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), test.args) |
| 397 | |
| 398 | r := requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Newscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/New().(t) |
| 399 | |
| 400 | if test.errStr != "" { |
| 401 | r.ErrorContainsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#ErrorContains().(err, test.errStr) |
| 402 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(1, numUsageErrors) |
| 403 | } else { |
| 404 | if test.expectedSvals != nil { |
| 405 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(test.expectedSvals, svals) |
| 406 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(test.expectedSvals, cmd.Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.[0].StringArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#StringArgs().("sa")) |
| 407 | } |
| 408 | if test.expectedTVals != nil { |
| 409 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(test.expectedTVals, tvals) |
| 410 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(test.expectedTVals, cmd.Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.[0].TimestampArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#TimestampArgs().("ta")) |
| 411 | } |
| 412 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(test.expectedIval, ival) |
| 413 | } |
| 414 | }) |
| 415 | } |
| 416 | } |
| 417 | |
| 418 | func TestArgUsagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestArgUsage().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 419 | arg := &IntArgscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/IntArg#{ |
| 420 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentBase#Name.: "ia", |
| 421 | } |
| 422 | tests := []struct { |
| 423 | name string |
| 424 | usage string |
| 425 | expected string |
| 426 | }{ |
| 427 | { |
| 428 | name: "default", |
| 429 | expected: "ia", |
| 430 | }, |
| 431 | { |
| 432 | name: "usage", |
| 433 | usage: "foo-usage", |
| 434 | expected: "foo-usage", |
| 435 | }, |
| 436 | } |
| 437 | for _, test := range tests { |
| 438 | t.Runscip-go gomod github.com/golang/go/src go1.22 testing/T#Run().(test.name, func(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 439 | arg.UsageTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentBase#UsageText. = test.usage |
| 440 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Equal().(t, test.expected, arg.Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentBase#Usage().()) |
| 441 | }) |
| 442 | } |
| 443 | } |
| 444 | |
| 445 | func TestArgsUsagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestArgsUsage().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 446 | arg := &IntArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/IntArgs#{ |
| 447 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Name.: "ia", |
| 448 | Minscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Min.: 0, |
| 449 | Maxscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#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 { |
| 503 | t.Runscip-go gomod github.com/golang/go/src go1.22 testing/T#Run().(test.name, func(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 504 | arg.Minscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Min., arg.Maxscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Max., arg.UsageTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#UsageText. = test.min, test.max, test.usage |
| 505 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Equal().(t, test.expected, arg.Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Usage().()) |
| 506 | }) |
| 507 | } |
| 508 | } |
| 509 | |
| 510 | func TestSingleOptionalArgscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestSingleOptionalArg().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 511 | tests := []struct { |
| 512 | name string |
| 513 | args []string |
| 514 | argValue string |
| 515 | exp string |
| 516 | }{ |
| 517 | { |
| 518 | name: "no args", |
| 519 | args: []string{"foo"}, |
| 520 | exp: "", |
| 521 | }, |
| 522 | { |
| 523 | name: "no arg with def value", |
| 524 | args: []string{"foo"}, |
| 525 | argValue: "bar", |
| 526 | exp: "bar", |
| 527 | }, |
| 528 | { |
| 529 | name: "one arg", |
| 530 | args: []string{"foo", "zbar"}, |
| 531 | exp: "zbar", |
| 532 | }, |
| 533 | } |
| 534 | |
| 535 | for _, test := range tests { |
| 536 | t.Runscip-go gomod github.com/golang/go/src go1.22 testing/T#Run().(test.name, func(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 537 | cmd := buildMinimalTestCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildMinimalTestCommand().() |
| 538 | var s1 string |
| 539 | arg := &StringArgscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringArg#{ |
| 540 | Valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentBase#Value.: test.argValue, |
| 541 | Destinationscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentBase#Destination.: &s1, |
| 542 | } |
| 543 | cmd.Argumentsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Arguments. = []Argumentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Argument#{ |
| 544 | arg, |
| 545 | } |
| 546 | |
| 547 | err := cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), test.args) // |
| 548 | r := requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Newscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/New().(t) |
| 549 | r.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#NoError().(err) |
| 550 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(test.exp, s1) |
| 551 | }) |
| 552 | } |
| 553 | } |
| 554 | |
| 555 | func TestUnboundedArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestUnboundedArgs().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 556 | arg := &StringArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringArgs#{ |
| 557 | Minscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Min.: 0, |
| 558 | Maxscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Max.: -1, |
| 559 | } |
| 560 | tests := []struct { |
| 561 | name string |
| 562 | args []string |
| 563 | defValues []string |
| 564 | values []string |
| 565 | expected []string |
| 566 | }{ |
| 567 | { |
| 568 | name: "cmd accepts no args", |
| 569 | args: []string{"foo"}, |
| 570 | expected: []string{}, |
| 571 | }, |
| 572 | { |
| 573 | name: "cmd uses given args", |
| 574 | args: []string{"foo", "bar", "baz"}, |
| 575 | expected: []string{"bar", "baz"}, |
| 576 | }, |
| 577 | { |
| 578 | name: "cmd uses default values", |
| 579 | args: []string{"foo"}, |
| 580 | expected: []string{}, |
| 581 | }, |
| 582 | { |
| 583 | name: "given args override default values", |
| 584 | args: []string{"foo", "bar", "baz"}, |
| 585 | values: []string{"zbar", "zbaz"}, |
| 586 | expected: []string{"bar", "baz"}, |
| 587 | }, |
| 588 | } |
| 589 | |
| 590 | for _, test := range tests { |
| 591 | t.Runscip-go gomod github.com/golang/go/src go1.22 testing/T#Run().(test.name, func(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 592 | cmd := buildMinimalTestCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildMinimalTestCommand().() |
| 593 | cmd.Argumentsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Arguments. = []Argumentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Argument#{arg} |
| 594 | arg.Destinationscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Destination. = &test.values |
| 595 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NoError().(t, cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(contextscip-go gomod github.com/golang/go/src go1.22 context/.Backgroundscip-go gomod github.com/golang/go/src go1.22 context/Background().(), test.args)) |
| 596 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Equal().(t, test.expected, *arg.Destinationscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ArgumentsBase#Destination.) |
| 597 | }) |
| 598 | } |
| 599 | } |