Skip to content

AssertNotCalled() panics because mutex is nil #1208

Closed
@gkdr

Description

@gkdr

hello,

thank you for your continued work on this library.

i have an issue that for some reason only came up today, but i believe this is a similar issue to #1206. i have one test which only checks that a function was not called using AssertNotCalled(), which now fails because the mutex is nil and testify panics.

i instantiate the mock using new, is that wrong?

i am willing to prepare a PR for you, but i am not sure what the fix is. in #1207, a check is added:

	if m.mutex == nil {
		m.mutex = &sync.Mutex{}
	}

does this need to be added to all of AssertNotCalled(), AssertCalled(), AssertNumberOfCalls()? is that all or are there any other places?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions