Skip to content

Commit cc55697

Browse files
committed
doc: update readme.
1 parent f1b4a0b commit cc55697

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

README.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ func TestExample(t *testing.T) {
2626
// var expect
2727

2828
// assert equality
29-
assert.DeepEqual(t, actual, expect)
29+
assert.Equal(t, actual, expect)
3030

3131
// assert inequality
32-
assert.NotDeepEqual(t, actual, expect)
32+
assert.NotEqual(t, actual, expect)
3333

3434
// var object
3535

@@ -61,15 +61,15 @@ func TestPanic(t *testing.T) {
6161
}
6262
```
6363

64-
For every assertion functions, it also provided `XXXNow` functions to stop the execution.
64+
For every assertion functions, it also provided `XXXNow` functions to stop the execution if the test is failed.
6565

6666
```go
6767
func TestExample(t *testing.T) {
6868
// var actual
6969
// var expect
7070

7171
// The following line will set the test result to fail and stop the execution
72-
assert.DeepEqualNow(t, actual, expect)
72+
assert.EqualNow(t, actual, expect)
7373

7474
// The following lines will never execute if they are not deep equal.
7575
// ...
@@ -80,7 +80,7 @@ Every assertion will not terminate the testing workflow. However, they'll return
8080

8181
```go
8282
func TestExample(t *testing.T) {
83-
if err := assert.DeepEqual(t, actual, expect); err != nil {
83+
if err := assert.Equal(t, actual, expect); err != nil {
8484
// terminate test
8585
t.Fail()
8686
}
@@ -94,13 +94,21 @@ func TestExample(t *testing.T) {
9494
assertion := assert.New(t)
9595

9696
// test equality
97-
assertion.DeepEqual(actual, expect)
97+
assertion.Equal(actual, expect)
9898

9999
// Test inequality
100-
assertion.NotDeepEqual(actual, expect)
100+
assertion.NotEqual(actual, expect)
101101
}
102102
```
103103

104+
## Available Assertions
105+
106+
- [`DeepEqual`](https://pkg.go.dev/github.com/ghosind/go-assert#Assertion.DeepEqual) and [`NotDeepEqual`](https://pkg.go.dev/github.com/ghosind/go-assert#Assertion.NotDeepEqual): assert the deep equality or inequality.
107+
- [`Equal`](https://pkg.go.dev/github.com/ghosind/go-assert#Assertion.Equal) and [`NotEqual`](https://pkg.go.dev/github.com/ghosind/go-assert#Assertion.NotEqual): assert the equality or inequality.
108+
- [`Nil`](https://pkg.go.dev/github.com/ghosind/go-assert#Assertion.Nil) and [`NotNil`](https://pkg.go.dev/github.com/ghosind/go-assert#Assertion.NotNil): assert the value is nil or not.
109+
- [`Panic`](https://pkg.go.dev/github.com/ghosind/go-assert#Assertion.Panic) and [`NotPanic`](https://pkg.go.dev/github.com/ghosind/go-assert#Assertion.NotPanic): assert the function will panic or not.
110+
- [`True`](https://pkg.go.dev/github.com/ghosind/go-assert#Assertion.True) and [`NotTrue`](https://pkg.go.dev/github.com/ghosind/go-assert#Assertion.NotTrue): assert the truthy of the value.
111+
104112
## License
105113

106114
This project was published under the MIT license, you can see [LICENSE](./LICENSE) file to get more information.

0 commit comments

Comments
 (0)