diff --git a/mock/mock_test.go b/mock/mock_test.go index 5cb40e366..f77dfe461 100644 --- a/mock/mock_test.go +++ b/mock/mock_test.go @@ -151,7 +151,7 @@ func Test_Mock_Chained_On(t *testing.T) { var mockedService = new(TestExampleImplementation) // determine our current line number so we can assert the expected calls callerInfo properly - _, _, line, _ := runtime.Caller(0) + _, filename, line, _ := runtime.Caller(0) mockedService. On("TheExampleMethod", 1, 2, 3). Return(0). @@ -164,14 +164,14 @@ func Test_Mock_Chained_On(t *testing.T) { Method: "TheExampleMethod", Arguments: []interface{}{1, 2, 3}, ReturnArguments: []interface{}{0}, - callerInfo: []string{fmt.Sprintf("mock_test.go:%d", line+2)}, + callerInfo: []string{fmt.Sprintf("%s:%d", filename, line+2)}, }, { Parent: &mockedService.Mock, Method: "TheExampleMethod3", Arguments: []interface{}{AnythingOfType("*mock.ExampleType")}, ReturnArguments: []interface{}{nil}, - callerInfo: []string{fmt.Sprintf("mock_test.go:%d", line+4)}, + callerInfo: []string{fmt.Sprintf("%s:%d", filename, line+4)}, }, } assert.Equal(t, expectedCalls, mockedService.ExpectedCalls) @@ -521,7 +521,7 @@ func Test_Mock_Chained_UnsetOnlyUnsetsLastCall(t *testing.T) { var mockedService = new(TestExampleImplementation) // determine our current line number so we can assert the expected calls callerInfo properly - _, _, line, _ := runtime.Caller(0) + _, filename, line, _ := runtime.Caller(0) mockedService. On("TheExampleMethod1", 1, 1). Return(0). @@ -536,14 +536,14 @@ func Test_Mock_Chained_UnsetOnlyUnsetsLastCall(t *testing.T) { Method: "TheExampleMethod1", Arguments: []interface{}{1, 1}, ReturnArguments: []interface{}{0}, - callerInfo: []string{fmt.Sprintf("mock_test.go:%d", line+2)}, + callerInfo: []string{fmt.Sprintf("%s:%d", filename, line+2)}, }, { Parent: &mockedService.Mock, Method: "TheExampleMethod2", Arguments: []interface{}{2, 2}, ReturnArguments: []interface{}{}, - callerInfo: []string{fmt.Sprintf("mock_test.go:%d", line+4)}, + callerInfo: []string{fmt.Sprintf("%s:%d", filename, line+4)}, }, } assert.Equal(t, 2, len(expectedCalls))