MCPcopy Create free account
hub / github.com/google/gapid / ExampleNotNil

Function ExampleNotNil

core/assert/value_test.go:86–103  ·  view source on GitHub ↗

An example of testing non nil values

()

Source from the content-addressed store, hash-verified

84
85// An example of testing non nil values
86func ExampleNotNil() {
87 notNil := &struct{ s string }{"not_nil"}
88 assert := assert.To(nil)
89 assert.For("not_nil equals nil").That(notNil).Equals(nil)
90 assert.For("not_nil does not equal nil").That(notNil).NotEquals(nil)
91 assert.For("not_nil deep equals nil").That(notNil).DeepEquals(nil)
92 assert.For("not_nil is nil").That(notNil).IsNil()
93 assert.For("not_nil is not nil").That(notNil).IsNotNil()
94 // Output:
95 // Error:not_nil equals nil
96 // Got &{not_nil}
97 // Expect == <nil>
98 // Error:not_nil deep equals nil
99 // nil ⟦&{s:not_nil}⟧ != ⟦<nil>⟧
100 // Error:not_nil is nil
101 // Got &{not_nil}
102 // Expect == `nil`
103}
104
105// An example of using value Equals
106func ExampleValueEquals() {

Callers

nothing calls this directly

Calls 7

ThatMethod · 0.80
ForMethod · 0.80
IsNotNilMethod · 0.80
EqualsMethod · 0.65
NotEqualsMethod · 0.45
DeepEqualsMethod · 0.45
IsNilMethod · 0.45

Tested by

no test coverage detected