Skip to content

Commit 9d75e99

Browse files
committed
feat: mark test helper functions.
1 parent 1436037 commit 9d75e99

File tree

6 files changed

+26
-0
lines changed

6 files changed

+26
-0
lines changed

assertion_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ func testAssertionFunction(a *Assertion, name string, fn func() error, expectSuc
4848
}
4949

5050
func testAssertionNowFunction(a *Assertion, name string, fn func(), expectExit bool) {
51+
a.T.Helper()
52+
5153
isTerminated := internal.CheckTermination(fn)
5254
if expectExit {
5355
a.TrueNow(isTerminated, "%s() execution stopped, want do not stop", name)

compare_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ func TestDeepEqualAndNotDeepEqual(t *testing.T) {
3333
}
3434

3535
func testDeepEqualAndNotDeepEqual(a, mockA *Assertion, v1, v2 any, isEqual bool) {
36+
a.T.Helper()
37+
3638
// DeepEqual
3739
testAssertionFunction(a, "DeepEqual", func() error {
3840
return DeepEqual(mockA.T, v1, v2)
@@ -98,6 +100,8 @@ func TestEqualAndNotEqual(t *testing.T) {
98100
}
99101

100102
func testEqualAndNotEqual(a, mockA *Assertion, v1, v2 any, isEqual bool) {
103+
a.T.Helper()
104+
101105
// Equal
102106
testAssertionFunction(a, "Equal", func() error {
103107
return Equal(mockA.T, v1, v2)
@@ -144,6 +148,8 @@ func TestNilAndNotNil(t *testing.T) {
144148
}
145149

146150
func testNilAndNotNil(a, mockA *Assertion, v any, isNil bool) {
151+
a.T.Helper()
152+
147153
// Nil
148154
testAssertionFunction(a, "Nil", func() error {
149155
return Nil(mockA.T, v)
@@ -194,6 +200,8 @@ func TestTrueAndNotTrue(t *testing.T) {
194200
}
195201

196202
func testTrueAndNotTrue(a, mockA *Assertion, v any, isTruthy bool) {
203+
a.T.Helper()
204+
197205
// True
198206
testAssertionFunction(a, "True", func() error {
199207
return True(mockA.T, v)

map_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ func tesMapHasKeyAndNotMapHasKey(
2222
m, key any,
2323
isHasKey bool,
2424
) {
25+
a.T.Helper()
26+
2527
// MapHasKey
2628
testAssertionFunction(a, "MapHasKey", func() error {
2729
return MapHasKey(mockA.T, m, key)
@@ -73,6 +75,8 @@ func tesMapHasValueAndNotMapHasValue(
7375
m, key any,
7476
isHasValue bool,
7577
) {
78+
a.T.Helper()
79+
7680
// MapHasValue
7781
testAssertionFunction(a, "MapHasValue", func() error {
7882
return MapHasValue(mockA.T, m, key)

panic_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ func TestPanicAndNotPanic(t *testing.T) {
1717
}
1818

1919
func testPanicAndNotPanic(a, mockA *Assertion, fn func(), isPanic bool) {
20+
a.T.Helper()
21+
2022
// Panic
2123
testAssertionFunction(a, "Panic", func() error {
2224
return Panic(mockA.T, fn)

slice_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ func testElementContainsAndNotContains(
2323
source, expect any,
2424
isContains bool,
2525
) {
26+
a.T.Helper()
27+
2628
// ContainsElement
2729
testAssertionFunction(a, "ContainsElement", func() error {
2830
return ContainsElement(mockA.T, source, expect)

string_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ func testStringContainsAndNotContains(
2424
str, substr string,
2525
isContains bool,
2626
) {
27+
a.T.Helper()
28+
2729
// ContainsString
2830
testAssertionFunction(a, "ContainsString", func() error {
2931
return ContainsString(mockA.T, str, substr)
@@ -75,6 +77,8 @@ func testStringHasPrefixAndNotHasPrefix(
7577
str, prefix string,
7678
isHasPrefix bool,
7779
) {
80+
a.T.Helper()
81+
7882
// HasPrefixString
7983
testAssertionFunction(a, "HasPrefixString", func() error {
8084
return HasPrefixString(mockA.T, str, prefix)
@@ -126,6 +130,8 @@ func testStringHasSuffixAndNotHasSuffix(
126130
str, suffix string,
127131
isHasSuffix bool,
128132
) {
133+
a.T.Helper()
134+
129135
// HasSuffixString
130136
testAssertionFunction(a, "HasSuffixString", func() error {
131137
return HasSuffixString(mockA.T, str, suffix)
@@ -170,6 +176,8 @@ func TestMatchAndNotMatch(t *testing.T) {
170176
}
171177

172178
func testMatchAndNotMatch(a, mockA *Assertion, val string, pattern string, isMatch bool) {
179+
a.T.Helper()
180+
173181
regPattern := regexp.MustCompile(pattern)
174182

175183
// MatchString

0 commit comments

Comments
 (0)