Go library for mocking exec.Command and exec.CommandContext calls.
LGPL-3.0 License
Go library for mocking exec.Command
and exec.CommandContext
calls.
Aims to provide an as close as possible [exec.Cmd]-like interface for
drop-in support.
cmd.Stdin
(or in/err
), use SetStdin()
See our Go docs.
Normally, you shouldn't need to assert anything as your function that executes a command should give you testing signal (is it working or not 😉). However, you can assert certain fields with this library. Currently, this is limited to Stdin checking.
If you set [MockCommand.Stdin] and call SetStdin
in the function
executing a command, Stdin
will be checked to ensure it is equal. This
is to allow greater testing if required.
LGPL-3.0