Go testing examples
Some test writing examples in Golang.
☝️ Every folder contains a different testing methods using standard libraries, convey and fuzz testing.
👉 We tried to keep it as simple as possible to make the logic behind the test as clear as possible.
How to run test:
- checkout selected folder e.g.
$ cd compare
- create
go.mod
💡$ go mod init example.com/m
to initialize a v0 or v1 module$ go mod tidy
to create go.mod file
- finally, run the test by
$ go test
✅
Check test coverage:
if you want to double-check if your cover 100% or not
- run
$ go test -cover
😎