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

Function ExampleNil

core/assert/value_test.go:49–63  ·  view source on GitHub ↗

An example of testing untyped nil values

()

Source from the content-addressed store, hash-verified

47
48// An example of testing untyped nil values
49func ExampleNil() {
50 assert := assert.To(nil)
51 assert.For("nil equals nil").That(nil).Equals(nil)
52 assert.For("nil does not equal nil").That(nil).NotEquals(nil)
53 assert.For("nil deep equals nil").That(nil).DeepEquals(nil)
54 assert.For("nil is nil").That(nil).IsNil()
55 assert.For("nil is not nil").That(nil).IsNotNil()
56 // Output:
57 // Error:nil does not equal nil
58 // Got <nil>
59 // Expect != <nil>
60 // Error:nil is not nil
61 // Got <nil>
62 // Expect != `nil`
63}
64
65// An example of testing typed nil values
66func ExampleTypedNil() {

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