MCPcopy
hub / github.com/stretchr/testify / Test_samePointers

Function Test_samePointers

assert/assertions_test.go:675–740  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

673}
674
675func Test_samePointers(t *testing.T) {
676 t.Parallel()
677
678 p := ptr(2)
679
680 type args struct {
681 first interface{}
682 second interface{}
683 }
684 tests := []struct {
685 name string
686 args args
687 same BoolAssertionFunc
688 ok BoolAssertionFunc
689 }{
690 {
691 name: "1 != 2",
692 args: args{first: 1, second: 2},
693 same: False,
694 ok: False,
695 },
696 {
697 name: "1 != 1 (not same ptr)",
698 args: args{first: 1, second: 1},
699 same: False,
700 ok: False,
701 },
702 {
703 name: "ptr(1) == ptr(1)",
704 args: args{first: p, second: p},
705 same: True,
706 ok: True,
707 },
708 {
709 name: "int(1) != float32(1)",
710 args: args{first: int(1), second: float32(1)},
711 same: False,
712 ok: False,
713 },
714 {
715 name: "array != slice",
716 args: args{first: [2]int{1, 2}, second: []int{1, 2}},
717 same: False,
718 ok: False,
719 },
720 {
721 name: "non-pointer vs pointer (1 != ptr(2))",
722 args: args{first: 1, second: p},
723 same: False,
724 ok: False,
725 },
726 {
727 name: "pointer vs non-pointer (ptr(2) != 1)",
728 args: args{first: p, second: 1},
729 same: False,
730 ok: False,
731 },
732 }

Callers

nothing calls this directly

Calls 3

ptrFunction · 0.85
samePointersFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected