Skip to content

Commit 32f1894

Browse files
committed
doc: update readme.
1 parent 90e2f55 commit 32f1894

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,17 @@ This library provided assertion functions to verify the equality of values, or a
2222

2323
```go
2424
func TestExample(t *testing.T) {
25+
// var actual
26+
// var expect
27+
2528
// assert equality
2629
assert.DeepEqual(t, actual, expect)
2730

2831
// assert inequality
2932
assert.NotDeepEqual(t, actual, expect)
3033

34+
// var object
35+
3136
// assert for nil
3237
assert.Nil(t, object)
3338

@@ -56,6 +61,21 @@ func TestPanic(t *testing.T) {
5661
}
5762
```
5863

64+
For every assertion functions, it also provided `XXXNow` functions to stop the execution.
65+
66+
```go
67+
func TestExample(t *testing.T) {
68+
// var actual
69+
// var expect
70+
71+
// The following line will set the test result to fail and stop the execution
72+
assert.DeepEqualNow(t, actual, expect)
73+
74+
// The following lines will never execute if they are not deep equal.
75+
// ...
76+
}
77+
```
78+
5979
Every assertion will not terminate the testing workflow. However, they'll return an error if the verification failed, and you can check the return value to get the verification result.
6080

6181
```go

0 commit comments

Comments
 (0)