This is a flexible and extensible assertion library designed to provide a unified interface for asserting conditions in Go tests. It allows developers to seamlessly integrate assertion functionality into their tests without being tied to a specific assertion library.
- General assertion interface for asserting conditions in tests.
- Supports various assertion functions for different types of conditions.
- Easy-to-use assertion functions for consistent handling of assertions in tests.
To install the assertion library, use the following command:
go get oss.nandlabs.io/golly/testing/assert
- Import the library into your Go test file:
import "oss.nandlabs.io/golly/testing/assert"
- Use the assertion functions in your test cases. For example:
func TestAdd(t *testing.T) { result := add(1, 2) assert.Equal(t, result, 3) }
- Run your tests using the
go test
command:go test
- View the test results and assertions in the test output.