MCPcopy
hub / github.com/expr-lang/expr / TestLenWrapper

Function TestLenWrapper

internal/testify/assert/forward_assertions_test.go:390–428  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

388}
389
390func TestLenWrapper(t *testing.T) {
391 assert := New(t)
392 mockAssert := New(new(testing.T))
393
394 assert.False(mockAssert.Len(nil, 0), "nil does not have length")
395 assert.False(mockAssert.Len(0, 0), "int does not have length")
396 assert.False(mockAssert.Len(true, 0), "true does not have length")
397 assert.False(mockAssert.Len(false, 0), "false does not have length")
398 assert.False(mockAssert.Len('A', 0), "Rune does not have length")
399 assert.False(mockAssert.Len(struct{}{}, 0), "Struct does not have length")
400
401 ch := make(chan int, 5)
402 ch <- 1
403 ch <- 2
404 ch <- 3
405
406 cases := []struct {
407 v interface{}
408 l int
409 }{
410 {[]int{1, 2, 3}, 3},
411 {[...]int{1, 2, 3}, 3},
412 {"ABC", 3},
413 {map[int]int{1: 2, 2: 4, 3: 6}, 3},
414 {ch, 3},
415
416 {[]int{}, 0},
417 {map[int]int{}, 0},
418 {make(chan int), 0},
419
420 {[]int(nil), 0},
421 {map[int]int(nil), 0},
422 {(chan int)(nil), 0},
423 }
424
425 for _, c := range cases {
426 assert.True(mockAssert.Len(c.v, c.l), "%#v have %d items", c.v, c.l)
427 }
428}
429
430func TestWithinDurationWrapper(t *testing.T) {
431 assert := New(t)

Callers

nothing calls this directly

Calls 4

NewFunction · 0.70
FalseMethod · 0.45
LenMethod · 0.45
TrueMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…