function signature

The name, parameters and their order that define how a function must be called.

In more detail

Callers, replacements and test doubles must match it exactly, or calls will not compile or will fail. Documentation tools usually print the signature first because it answers most questions about a function.

Examples

func Getenv(key string) string
In this course: A test double must have the same signature as the thing it replaces, or it will accept calls the real one would reject. unittest.mock's autospec copies the real signature so a wrong call fails the test.

Related terms

Taught in

References