func PPtr(val any) TestDeep
PPtr is a smuggler operator. It takes the address of the address of data and compares it to val.
val depends on data type. For example, if the compared data is an
**int
, one can have:
num := 12
pnum = &num
td.Cmp(t, &pnum, td.PPtr(12)) // succeeds
as well as an other operator:
num := 3
pnum = &num
td.Cmp(t, &pnum, td.PPtr(td.Between(3, 4))) // succeeds
It is more efficient and shorter to write than:
td.Cmp(t, &pnum, td.Ptr(td.Ptr(val))) // succeeds too
TypeBehind
method returns the reflect.Type
of a pointer on a
pointer on val, except if val is a TestDeep operator. In this
case, it delegates TypeBehind()
to the operator and returns the
reflect.Type
of a pointer on a pointer on the returned value (if
non-nil
of course).
See also
Ptr
.
See also PPtr godoc.
func CmpPPtr(t TestingT, got, val any, args ...any) bool
CmpPPtr is a shortcut for:
td.Cmp(t, got, td.PPtr(val), args...)
See above for details.
Returns true if the test is OK, false if it fails.
If t is a *T
then its Config field is inherited.
args… are optional and allow to name the test. This name is
used in case of failure to qualify the test. If len(args) > 1
and
the first item of args is a string
and contains a ‘%’ rune
then
fmt.Fprintf
is used to compose the name, else args are passed to
fmt.Fprint
. Do not forget it is the name of the test, not the
reason of a potential failure.
See also CmpPPtr godoc.
func (t *T) PPtr(got, val any, args ...any) bool
PPtr is a shortcut for:
t.Cmp(got, td.PPtr(val), args...)
See above for details.
Returns true if the test is OK, false if it fails.
args… are optional and allow to name the test. This name is
used in case of failure to qualify the test. If len(args) > 1
and
the first item of args is a string
and contains a ‘%’ rune
then
fmt.Fprintf
is used to compose the name, else args are passed to
fmt.Fprint
. Do not forget it is the name of the test, not the
reason of a potential failure.
See also T.PPtr godoc.