MCPcopy Index your code
hub / github.com/gavv/httpexpect / TestArray_ComparatorErrors

Function TestArray_ComparatorErrors

array_test.go:2517–2570  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2515}
2516
2517func TestArray_ComparatorErrors(t *testing.T) {
2518 t.Run("nil slice", func(t *testing.T) {
2519 chain := newMockChain(t).enter("test")
2520
2521 fn := builtinComparator(chain, nil)
2522
2523 assert.Nil(t, fn)
2524 chain.assert(t, success)
2525 })
2526
2527 t.Run("0 elements", func(t *testing.T) {
2528 chain := newMockChain(t).enter("test")
2529
2530 fn := builtinComparator(chain, []interface{}{})
2531
2532 assert.Nil(t, fn)
2533 chain.assert(t, success)
2534 })
2535
2536 t.Run("1 element", func(t *testing.T) {
2537 chain := newMockChain(t).enter("test")
2538
2539 fn := builtinComparator(chain, []interface{}{
2540 "test",
2541 })
2542
2543 assert.Nil(t, fn)
2544 chain.assert(t, success)
2545 })
2546
2547 t.Run("2 elements, bad_type", func(t *testing.T) {
2548 chain := newMockChain(t).enter("test")
2549
2550 fn := builtinComparator(chain, []interface{}{
2551 "test",
2552 make(chan int), // bad type
2553 })
2554
2555 assert.Nil(t, fn)
2556 chain.assert(t, failure)
2557 })
2558
2559 t.Run("2 elements, good types", func(t *testing.T) {
2560 chain := newMockChain(t).enter("test")
2561
2562 fn := builtinComparator(chain, []interface{}{
2563 "test",
2564 "test",
2565 })
2566
2567 assert.NotNil(t, fn)
2568 chain.assert(t, success)
2569 })
2570}

Callers

nothing calls this directly

Calls 4

newMockChainFunction · 0.85
builtinComparatorFunction · 0.85
enterMethod · 0.80
assertMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…