https://github.com/matryer/is
Professional lightweight testing mini-framework for Go.
https://github.com/matryer/is
golang testing
Last synced: 6 months ago
JSON representation
Professional lightweight testing mini-framework for Go.
- Host: GitHub
- URL: https://github.com/matryer/is
- Owner: matryer
- License: mit
- Created: 2016-12-06T13:24:01.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-02-08T21:33:15.000Z (almost 2 years ago)
- Last Synced: 2025-05-03T07:14:02.858Z (7 months ago)
- Topics: golang, testing
- Language: Go
- Homepage:
- Size: 386 KB
- Stars: 1,851
- Watchers: 23
- Forks: 60
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- go-awesome - is - 迷你测试框架 (开源类库 / 测试)
- go-awesome - is - Mini testing framework (Open source library / Test)
- awesome-go-extra - is - framework for Go.|1473|50|9|2016-12-06T13:24:01Z|2022-05-16T09:57:40Z| (Testing / Testing Frameworks)
- awesome-go-cn - is
- awesome-repositories - matryer/is - Professional lightweight testing mini-framework for Go. (Go)
- awesome-go-plus - is - Professional lightweight testing mini-framework for Go.  (Testing / Testing Frameworks)
- awesome-go - is - Professional lightweight testing mini-framework for Go. (Testing / HTTP Clients)
- awesome-go - is - Professional lightweight testing mini-framework for Go. Stars:`1.9K`. (Testing / Testing Frameworks)
- awesome-go - is - Professional lightweight testing mini-framework for Go. (Testing / HTTP Clients)
- awesome-go-with-stars - is - Professional lightweight testing mini-framework for Go. (Testing / Testing Frameworks)
- awesome-go - is - Professional lightweight testing mini-framework for Go. (Testing / Testing Frameworks)
- awesome-go - is - Professional lightweight testing mini-framework for Go. (Testing / Testing Frameworks)
- zero-alloc-awesome-go - is - Professional lightweight testing mini-framework for Go. (Testing / HTTP Clients)
- awesome-go-cn - is
- fucking-awesome-go - is - Professional lightweight testing mini-framework for Go. (Testing / Testing Frameworks)
README
# is [](http://godoc.org/github.com/matryer/is) [](https://goreportcard.com/report/github.com/matryer/is)
Professional lightweight testing mini-framework for Go.
* Easy to write and read
* [Beautifully simple API](https://pkg.go.dev/github.com/matryer/is) with everything you need: `is.Equal`, `is.True`, `is.NoErr`, and `is.Fail`
* Use comments to add descriptions (which show up when tests fail)
Failures are very easy to read:

### Usage
The following code shows a range of useful ways you can use
the helper methods:
```go
func Test(t *testing.T) {
is := is.New(t)
signedin, err := isSignedIn(ctx)
is.NoErr(err) // isSignedIn error
is.Equal(signedin, true) // must be signed in
body := readBody(r)
is.True(strings.Contains(body, "Hi there"))
}
```
## Color
To turn off the colors, run `go test` with the `-nocolor` flag,
or with the env var [`NO_COLOR` (with any value)](https://no-color.org).
```
go test -nocolor
```
```
NO_COLOR=1 go test
```