# README
Just some random matchers
The package provides a matcher interface to match a given value of any types.
Prerequisites
Go >= 1.18
Install
go get go.nhat.io/matcher/v3
Usage
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)
}
Donation
If this project help you reduce time to develop, you can give me a cup of coffee :)
Paypal donation
or scan this

# Packages
Package mock provides functionalities for mocking matchers.
# Functions
Equal matches two objects.
Equalf matches two strings by the formatted expectation.
Func matches by calling a function.
IsEmpty checks whether the value is empty.
IsNotEmpty checks whether the value is not empty.
IsType matches two types.
JSON matches two json strings with <ignore-diff> support.
Len matches by the length of the value.
Match returns a matcher according to its type.
Regex matches two strings by using regex.
SameTypeAs matches two types.
# Variables
Any returns a matcher that matches any value.
# Interfaces
Matcher determines if the actual matches the expectation.
# Type aliases
Callback matches by calling a function.