MCPcopy Create free account
hub / github.com/clouditor/clouditor / Optional

Function Optional

internal/testutil/assert/assert.go:119–125  ·  view source on GitHub ↗

Optional asserts the [want] function, if it is not nil. Otherwise, the assertion is ignored. This is helpful if an extra [Want] func is specified only for a select sub-set of table tests.

(t *testing.T, want Want[T], got T)

Source from the content-addressed store, hash-verified

117
118// Optional asserts the [want] function, if it is not nil. Otherwise, the assertion is ignored. This is helpful if an extra [Want] func is specified only for a select sub-set of table tests.
119func Optional[T any](t *testing.T, want Want[T], got T) bool {
120 if want != nil {
121 return want(t, got)
122 }
123
124 return true
125}

Calls

no outgoing calls