diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2024-02-01 22:34:52 -0500 |
|---|---|---|
| committer | Eugene Triguba <eugenetriguba@gmail.com> | 2024-02-01 22:34:52 -0500 |
| commit | c4f88b3173e34387147499f6f3a66b5595c7bf47 (patch) | |
| tree | b12eea8e762b9ca62a52c25fdb928e2f821ac504 /README.md | |
| parent | Fix typo (diff) | |
| download | checkmate-c4f88b3173e34387147499f6f3a66b5595c7bf47.zip | |
Add check module, add some not functions, and remove a few test fns
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 43 |
1 files changed, 0 insertions, 43 deletions
@@ -15,8 +15,6 @@ Checkmate is a Go library designed to enhance the testing experience by providing a set of assertion functions. With Go, there is no built-in assertion library which can make writing tests feel more verbose than it needs to be, so Checkmate aims to fill that gap. -This is a simple and small library. If you need something more advanced and full-featured, [Testify](https://github.com/stretchr/testify), [Gomega](https://github.com/onsi/gomega), or [gotest.tools](https://github.com/gotestyourself/gotest.tools) are all great options. - ## Installation To install Checkmate, use the following command: @@ -24,44 +22,3 @@ To install Checkmate, use the following command: ```bash $ go get github.com/eugenetriguba/checkmate ``` - -## Usage - -To get a feel for what Checkmate has to offer, here is a simple example with some commentary that shows all the supported assertion functions. For a reference on each function, see the [GoDoc](https://godoc.org/github.com/eugenetriguba/checkmate). - -```go - -import ( - "errors" - "os" - "testing" - - "github.com/eugenetriguba/checkmate/assert" -) - -func TestAssertions(t *testing.T) { - // Assert is the base general assertion function. It - // takes in any boolean expression and will fail the - // test if the expression is false. - assert.Assert(t, true) - - // Also note, all functions in this library take in an - // optional message argument which may have placeholders - // that are formatted with the remaining arguments. - assert.Assert(t, false, "expected %v to be true", false) - - // Check is like Assert, but it will not fail the test. - assert.Check(t, true) - - assert.True(t, true) - assert.False(t, false) - assert.Equal(t, 1, 1) - assert.DeepEqual(t, []int{1, 2, 3}, []int{1, 2, 3}) - assert.LenEqual(t, []int{1, 2, 3}, 3) - assert.NotEqual(t, 1, 2) - assert.Nil(t, nil) - assert.NotNil(t, "not nil") - assert.ErrorIs(t, os.ErrInvalid, os.ErrInvalid) - assert.ErrorContains(t, errors.New("error 1"), "error 1") -} -``` |