MCPcopy Create free account
hub / github.com/expr-lang/expr / Test_samePointers

Function Test_samePointers

internal/testify/assert/assertions_test.go:600–643  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

598}
599
600func Test_samePointers(t *testing.T) {
601 p := ptr(2)
602
603 type args struct {
604 first interface{}
605 second interface{}
606 }
607 tests := []struct {
608 name string
609 args args
610 assertion BoolAssertionFunc
611 }{
612 {
613 name: "1 != 2",
614 args: args{first: 1, second: 2},
615 assertion: False,
616 },
617 {
618 name: "1 != 1 (not same ptr)",
619 args: args{first: 1, second: 1},
620 assertion: False,
621 },
622 {
623 name: "ptr(1) == ptr(1)",
624 args: args{first: p, second: p},
625 assertion: True,
626 },
627 {
628 name: "int(1) != float32(1)",
629 args: args{first: int(1), second: float32(1)},
630 assertion: False,
631 },
632 {
633 name: "array != slice",
634 args: args{first: [2]int{1, 2}, second: []int{1, 2}},
635 assertion: False,
636 },
637 }
638 for _, tt := range tests {
639 t.Run(tt.name, func(t *testing.T) {
640 tt.assertion(t, samePointers(tt.args.first, tt.args.second))
641 })
642 }
643}
644
645// bufferT implements TestingT. Its implementation of Errorf writes the output that would be produced by
646// testing.T.Errorf to an internal bytes.Buffer.

Callers

nothing calls this directly

Calls 3

ptrFunction · 0.85
samePointersFunction · 0.85
RunMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…