Skip to content

Commit d328605

Browse files
author
Stavros Ntentos
committed
test: fix the tests that depended on the previous behavior
Signed-off-by: Stavros Ntentos <133706+stdedos@users.noreply.github.com>
1 parent bad14dc commit d328605

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

mock/mock_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func Test_Mock_Chained_On(t *testing.T) {
151151
var mockedService = new(TestExampleImplementation)
152152

153153
// determine our current line number so we can assert the expected calls callerInfo properly
154-
_, _, line, _ := runtime.Caller(0)
154+
_, filename, line, _ := runtime.Caller(0)
155155
mockedService.
156156
On("TheExampleMethod", 1, 2, 3).
157157
Return(0).
@@ -164,14 +164,14 @@ func Test_Mock_Chained_On(t *testing.T) {
164164
Method: "TheExampleMethod",
165165
Arguments: []interface{}{1, 2, 3},
166166
ReturnArguments: []interface{}{0},
167-
callerInfo: []string{fmt.Sprintf("mock_test.go:%d", line+2)},
167+
callerInfo: []string{fmt.Sprintf("%s:%d", filename, line+2)},
168168
},
169169
{
170170
Parent: &mockedService.Mock,
171171
Method: "TheExampleMethod3",
172172
Arguments: []interface{}{AnythingOfType("*mock.ExampleType")},
173173
ReturnArguments: []interface{}{nil},
174-
callerInfo: []string{fmt.Sprintf("mock_test.go:%d", line+4)},
174+
callerInfo: []string{fmt.Sprintf("%s:%d", filename, line+4)},
175175
},
176176
}
177177
assert.Equal(t, expectedCalls, mockedService.ExpectedCalls)
@@ -521,7 +521,7 @@ func Test_Mock_Chained_UnsetOnlyUnsetsLastCall(t *testing.T) {
521521
var mockedService = new(TestExampleImplementation)
522522

523523
// determine our current line number so we can assert the expected calls callerInfo properly
524-
_, _, line, _ := runtime.Caller(0)
524+
_, filename, line, _ := runtime.Caller(0)
525525
mockedService.
526526
On("TheExampleMethod1", 1, 1).
527527
Return(0).
@@ -536,14 +536,14 @@ func Test_Mock_Chained_UnsetOnlyUnsetsLastCall(t *testing.T) {
536536
Method: "TheExampleMethod1",
537537
Arguments: []interface{}{1, 1},
538538
ReturnArguments: []interface{}{0},
539-
callerInfo: []string{fmt.Sprintf("mock_test.go:%d", line+2)},
539+
callerInfo: []string{fmt.Sprintf("%s:%d", filename, line+2)},
540540
},
541541
{
542542
Parent: &mockedService.Mock,
543543
Method: "TheExampleMethod2",
544544
Arguments: []interface{}{2, 2},
545545
ReturnArguments: []interface{}{},
546-
callerInfo: []string{fmt.Sprintf("mock_test.go:%d", line+4)},
546+
callerInfo: []string{fmt.Sprintf("%s:%d", filename, line+4)},
547547
},
548548
}
549549
assert.Equal(t, 2, len(expectedCalls))

0 commit comments

Comments
 (0)