You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+25-4Lines changed: 25 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,10 +4,10 @@ If you want simple test assertions and feel like [testify](https://pkg.go.dev/gi
4
4
5
5
Highlights:
6
6
7
-
-Minimal API: `Equal`, `Err`, and `True` assertions.
8
-
-Correctly compares `time.Time` values and other types with an `Equal` method.
9
-
-Flexible error assertions: check if an error exists, check its value, type, or any combination of these.
10
-
-Zero hassle.
7
+
- Minimal API: `Equal`, `Err`, and `True` assertions.
8
+
- Correctly compares `time.Time` values and other types with an `Equal` method.
9
+
- Flexible error assertions: check if an error exists, check its value, type, or any combination of these.
10
+
- Zero hassle.
11
11
12
12
Be is new, but it's ready for production (or maybe I should say "testing" :) I've used it in three very different projects — a CLI tool, an API server, and a database engine — and it worked great every time.
13
13
@@ -19,6 +19,8 @@ Install with go get:
19
19
go get github.com/nalgeon/be
20
20
```
21
21
22
+
### Equality
23
+
22
24
`Equal` asserts that two values are equal:
23
25
24
26
```go
@@ -47,6 +49,8 @@ func Test(t *testing.T) {
47
49
}
48
50
```
49
51
52
+
### Errors
53
+
50
54
`Err` asserts that there is an error:
51
55
52
56
```go
@@ -119,6 +123,8 @@ func Test(t *testing.T) {
119
123
}
120
124
```
121
125
126
+
### True/false
127
+
122
128
`True` asserts that an expression is true:
123
129
124
130
```go
@@ -129,6 +135,21 @@ func Test(t *testing.T) {
129
135
}
130
136
```
131
137
138
+
### Conditional checks (work in progress)
139
+
140
+
Each `be` function also returns a `bool` that shows whether the assertion passed or failed. You can use this to stop early or run extra checks:
0 commit comments