https://github.com/weiwenchen2022/assert
Assert for Go 1.18+ test assertions
https://github.com/weiwenchen2022/assert
assertion go library testing
Last synced: 9 months ago
JSON representation
Assert for Go 1.18+ test assertions
- Host: GitHub
- URL: https://github.com/weiwenchen2022/assert
- Owner: weiwenchen2022
- License: bsd-3-clause
- Created: 2023-07-23T16:08:03.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-23T16:22:45.000Z (almost 3 years ago)
- Last Synced: 2025-06-02T01:15:26.793Z (about 1 year ago)
- Topics: assertion, go, library, testing
- Language: Makefile
- Homepage: https://godoc.org/github.com/weiwenchen2022/assert
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Assert for Go 1.18+ test assertions
## Install
```sh
go get github.com/weiwenchen2022/assert
```
## Usage
```go
package main
import (
"testing"
"github.com/weiwenchen2022/assert"
)
func greet(name string) (string, int) {
greeting := fmt.Sprintf("Hello %s", name)
// Return the greeting and its length (in bytes).
return greeting, len(greeting)
}
func TestGreet(t *testing.T) {
greeting, greetingLength := greet("Alice")
assert.Equal(t, "Hello Alice", greeting, "greeting:")
assert.Equal(t, 11, greetingLength, "greetingLength:")
}
```
## Reference
GoDoc: [https://godoc.org/github.com/weiwenchen2022/assert](https://godoc.org/github.com/weiwenchen2022/assert)