Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zanzythebar/assert-lib
A lightweight assertion library for Go.
https://github.com/zanzythebar/assert-lib
assert assertions assertions-library go golang systems-programming
Last synced: 18 days ago
JSON representation
A lightweight assertion library for Go.
- Host: GitHub
- URL: https://github.com/zanzythebar/assert-lib
- Owner: ZanzyTHEbar
- License: mit
- Created: 2024-10-15T16:15:20.000Z (21 days ago)
- Default Branch: master
- Last Pushed: 2024-10-16T09:39:48.000Z (21 days ago)
- Last Synced: 2024-10-18T04:53:04.302Z (19 days ago)
- Topics: assert, assertions, assertions-library, go, golang, systems-programming
- Language: Go
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Assert Go
A lightweight assertion library for Go, designed for systems and real-time programming with structured logging and flush controls.
## Installation
```bash
go get github.com/ZanzyTHEbar/assert-lib
```## Usage
```go
package mainimport (
"context"
"github.com/ZanzyTHEbar/assert-lib"
)func main() {
handler := assert.NewAssertHandler()
handler.Assert(context.TODO(), false, "This should fail")
}
```Check out the [examples](/examples/) directory for usage examples.
## Features
- **Assertions**: Assert, Nil, NotNil, NoError, Never.
- **Flush Management**: Control output flushes with AssertFlush.
- **Context-Based Logging**: Attach structured logging to your assertion calls.
- **Custom Loggers**: Use your own logger with the AssertHandler interface.## Examples
```bash
go run examples/basic_assertion.go
go run examples/deferred_assertions.go
go run examples/custom_exit.go
go run examples/formater.go
```