The package provides a matcher interface to match a given value of any types.
Go >= 1.18
go get go.nhat.io/matcher/v3
You could use it in a test or anywhere that needs a value matcher.
package mypackage
import (
"testing"
"github.com/stretchr/testify/assert"
"go.nhat.io/matcher/v3"
)
func TestValue(t *testing.T) {
m := matcher.Equal("foobar")
actual := "FOOBAR"
result, err := m.Match(actual)
assert.True(t, result, "got: %s, want: %s", actual, m.Expected())
assert.NoError(t, err)
}
If this project help you reduce time to develop, you can give me a cup of coffee :)
or scan this