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

Function ExampleValueAssertionFunc

internal/testify/require/requirements_test.go:446–472  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

444}
445
446func ExampleValueAssertionFunc() {
447 t := &testing.T{} // provided by test
448
449 dumbParse := func(input string) interface{} {
450 var x interface{}
451 json.Unmarshal([]byte(input), &x)
452 return x
453 }
454
455 tests := []struct {
456 name string
457 arg string
458 assertion ValueAssertionFunc
459 }{
460 {"true is not nil", "true", NotNil},
461 {"empty string is nil", "", Nil},
462 {"zero is not nil", "0", NotNil},
463 {"zero is zero", "0", Zero},
464 {"false is zero", "false", Zero},
465 }
466
467 for _, tt := range tests {
468 t.Run(tt.name, func(t *testing.T) {
469 tt.assertion(t, dumbParse(tt.arg))
470 })
471 }
472}
473
474func TestValueAssertionFunc(t *testing.T) {
475 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…