MCPcopy
hub / github.com/jesseduffield/lazygit / TestLimit

Function TestLimit

pkg/utils/slice_test.go:133–174  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

131}
132
133func TestLimit(t *testing.T) {
134 for _, test := range []struct {
135 values []string
136 limit int
137 want []string
138 }{
139 {
140 values: []string{"a", "b", "c"},
141 limit: 3,
142 want: []string{"a", "b", "c"},
143 },
144 {
145 values: []string{"a", "b", "c"},
146 limit: 4,
147 want: []string{"a", "b", "c"},
148 },
149 {
150 values: []string{"a", "b", "c"},
151 limit: 2,
152 want: []string{"a", "b"},
153 },
154 {
155 values: []string{"a", "b", "c"},
156 limit: 1,
157 want: []string{"a"},
158 },
159 {
160 values: []string{"a", "b", "c"},
161 limit: 0,
162 want: []string{},
163 },
164 {
165 values: []string{},
166 limit: 0,
167 want: []string{},
168 },
169 } {
170 if got := Limit(test.values, test.limit); !assert.EqualValues(t, got, test.want) {
171 t.Errorf("Limit(%v, %d) = %v; want %v", test.values, test.limit, got, test.want)
172 }
173 }
174}
175
176func TestLimitStr(t *testing.T) {
177 for _, test := range []struct {

Callers

nothing calls this directly

Calls 2

LimitFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected