由于未接来电而导致测试中止

I am trying to mock.Expecton a method that is called inside a local function.

When I do mock.Expect.AddNumbers(a, b).AnyTimes().Return(&result.sum, nil) the tests pass. But when I expect it to execute at least once, it fails. There are absolutely no other code paths before this call so it should not be failing.

I am using a simplified representation of the method here because this is a complex test setup/method. But this is definitely the gist of it.

My question is, is my test failing because the method I am mock.Expecting is not directly inside DoMath function?

add_test.go

import result

TestAdditionFunction(t *testing.T) {
    //mock setup stuff 
    ... 

    a := 1
    b := 2
    mock.Expect.AddNumbers(a, b).Times(1).Return(&result.sum, nil)
    sum = DoMath(a,b)
}


func DoMath(a int, b int) *result.sum, error {
   if( some condition ){
       someFunc(a,b)
   }
}

func someFunc(a int, b int) int {
   AddNumbers(a,b)
} 

Actually never mind. It's my bad. I didn't have correct environment variable set for the project.