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)
| 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. |
| 119 | func 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 | } |
no outgoing calls