@@ -4,36 +4,82 @@ import (
44 "testing"
55)
66
7- // DeepEqual tests deeply equality between actual and expect parameters.
7+ // DeepEqual tests the deep equality between actual and expect parameters. It'll set the result to
8+ // fail if they are not deeply equal, and it doesn't stop the execution.
89func DeepEqual (t * testing.T , actual , expect any , message ... string ) error {
910 return tryDeepEqual (t , false , actual , expect , message ... )
1011}
1112
12- // NotDeepEqual tests deeply inequality between actual and expected parameters.
13+ // DeepEqualNow tests the deep equality between actual and expect parameters, and it'll stop the
14+ // execution if they are not deeply equal.
15+ func DeepEqualNow (t * testing.T , actual , expect any , message ... string ) error {
16+ return tryDeepEqual (t , true , actual , expect , message ... )
17+ }
18+
19+ // NotDeepEqual tests the deep inequality between actual and expected parameters. It'll set the
20+ // result to fail if they are deeply equal, but it doesn't stop the execution.
1321func NotDeepEqual (t * testing.T , actual , expect any , message ... string ) error {
1422 return tryNotDeepEqual (t , false , actual , expect , message ... )
1523}
1624
25+ // NotDeepEqualNow tests the deep inequality between actual and expected parameters, and it'll stop
26+ // the execution if they are deeply equal.
27+ func NotDeepEqualNow (t * testing.T , actual , expect any , message ... string ) error {
28+ return tryNotDeepEqual (t , true , actual , expect , message ... )
29+ }
30+
1731// Nil tests whether a value is nil or not, and it'll fail when the value is not nil. It will
1832// always return false if the value is a bool, an integer, a floating number, a complex, or a
1933// string.
2034func Nil (t * testing.T , val any , message ... string ) error {
2135 return tryNil (t , false , val , message ... )
2236}
2337
38+ // NilNow tests whether a value is nil or not, and it'll fail when the value is not nil. It will
39+ // always return false if the value is a bool, an integer, a floating number, a complex, or a
40+ // string.
41+ //
42+ // This function will set the result to fail, and stop the execution if the value is not nil.
43+ func NilNow (t * testing.T , val any , message ... string ) error {
44+ return tryNil (t , true , val , message ... )
45+ }
46+
2447// NotNil tests whether a value is nil or not, and it'll fail when the value is nil. It will
2548// always return true if the value is a bool, an integer, a floating number, a complex, or a
2649// string.
2750func NotNil (t * testing.T , val any , message ... string ) error {
2851 return tryNotNil (t , false , val , message ... )
2952}
3053
31- // Panic expects the function fn to panic.
54+ // NotNilNow tests whether a value is nil or not, and it'll fail when the value is nil. It will
55+ // always return true if the value is a bool, an integer, a floating number, a complex, or a
56+ // string.
57+ //
58+ // This function will set the result to fail, and stop the execution if the value is nil.
59+ func NotNilNow (t * testing.T , val any , message ... string ) error {
60+ return tryNotNil (t , true , val , message ... )
61+ }
62+
63+ // Panic expects the function fn to panic, and it'll set the result to fail if the function doesn't
64+ // panic.
3265func Panic (t * testing.T , fn func (), message ... string ) error {
3366 return tryPanic (t , false , fn , message ... )
3467}
3568
36- // NotPanic asserts that the function fn does not panic.
69+ // PanicNow expects the function fn to panic. It'll set the result to fail if the function doesn't
70+ // panic, and stop the execution.
71+ func PanicNow (t * testing.T , fn func (), message ... string ) error {
72+ return tryPanic (t , true , fn , message ... )
73+ }
74+
75+ // NotPanic asserts that the function fn does not panic, and it'll set the result to fail if the
76+ // function panic.
3777func NotPanic (t * testing.T , fn func (), message ... string ) error {
3878 return tryNotPanic (t , false , fn , message ... )
3979}
80+
81+ // NotPanicNow asserts that the function fn does not panic. It'll set the result to fail if the
82+ // function panic, and it also stops the execution.
83+ func NotPanicNow (t * testing.T , fn func (), message ... string ) error {
84+ return tryNotPanic (t , false , fn , message ... )
85+ }
0 commit comments