https://github.com/aprosail/expect
A utilities library for golang testing.
https://github.com/aprosail/expect
expect go golang syntax-sugar test testing-tools tobe-evaluation
Last synced: 12 months ago
JSON representation
A utilities library for golang testing.
- Host: GitHub
- URL: https://github.com/aprosail/expect
- Owner: aprosail
- License: mit
- Created: 2024-05-12T04:02:29.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-23T06:02:46.000Z (about 2 years ago)
- Last Synced: 2024-05-23T06:33:01.002Z (about 2 years ago)
- Topics: expect, go, golang, syntax-sugar, test, testing-tools, tobe-evaluation
- Language: Go
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# expect
Syntax sugar for easier and highlighted golang testing.
Before:
```go
package demo_test
import (
"testing"
)
func TestDemo(t *testing.T) {
if 1 + 1 != 2 {
t.Fatalf("Expect %v, but got %v", 2, 1 + 1)
}
if 1 + 2 != 3 {
t.Fatalf("Expect %v, but got %v", 3, 1 + 2)
}
if 1 + 3 != 4 {
t.Fatalf("Expect %v, but got %v", 4, 1 + 3)
}
}
```
After:
```go
package demo_test
import (
"testing"
"github.com/aprosail/expect"
)
func TestDemo(t *testing.T) {
const expect = 2
const actual = 1 + 1
e := expect.Init(t, nil)
e.Expect(1 + 1).ToBe(2)
e.Expect(1 + 2).ToBe(3)
e.Expect(1 + 3).ToBe(4)
}
```