Skip to content

About

Just some random matchers

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Repository files navigation

Just some random matchers

GitHub Releases Build Status codecov GoDevDoc Donate

The package provides a matcher interface to match a given value of any types.

Prerequisites

  • Go >= 1.23

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 saved you some development time, buy me a cup of coffee :)

donate

       or scan this

[table of contents]

About

Just some random matchers

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

⌂ 换网址