Just some random matchers
The package provides a matcher interface to match a given value of any types.
Prerequisites
Go >= 1.16
Install
go get github.com/nhatthm/go-matcher
Usage
You could use it in a test or anywhere that needs a value matcher.
package mypackage
import (
"testing"
"github.com/nhatthm/go-matcher"
"github.com/stretchr/testify/assert"
)
func TestValue(t *testing.T) {
m := matcher.Exact("foobar")
actual := "FOOBAR"
assert.True(t, m.Match(actual), "got: %s, want: %s", actual, m.Expected())
}
Donation
If this project help you reduce time to develop, you can give me a cup of coffee :)
Paypal donation
or scan this