MCPcopy Create free account
hub / github.com/expr-lang/expr / ExampleValueAssertionFunc

Function ExampleValueAssertionFunc

internal/testify/assert/assertions_test.go:2583–2609  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2581}
2582
2583func ExampleValueAssertionFunc() {
2584 t := &testing.T{} // provided by test
2585
2586 dumbParse := func(input string) interface{} {
2587 var x interface{}
2588 _ = json.Unmarshal([]byte(input), &x)
2589 return x
2590 }
2591
2592 tests := []struct {
2593 name string
2594 arg string
2595 assertion ValueAssertionFunc
2596 }{
2597 {"true is not nil", "true", NotNil},
2598 {"empty string is nil", "", Nil},
2599 {"zero is not nil", "0", NotNil},
2600 {"zero is zero", "0", Zero},
2601 {"false is zero", "false", Zero},
2602 }
2603
2604 for _, tt := range tests {
2605 t.Run(tt.name, func(t *testing.T) {
2606 tt.assertion(t, dumbParse(tt.arg))
2607 })
2608 }
2609}
2610
2611func TestValueAssertionFunc(t *testing.T) {
2612 tests := []struct {

Callers

nothing calls this directly

Calls 1

RunMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…