Documentation ¶
Overview ¶
Define your main function so that it matches the signature of testcli.MainFunc. In tests, call your main function using testcli.Main which will capture stdout, stderr, and the exit code. Use the other helper functions to create a working directory that suites the use cases that need testing.
For an example of this used in the wild, see the tests of gas: https://4d63.com/gas
Index ¶
- func Chdir(t testing.TB, dir string)
- func Exec(t testing.TB, command string) (exitCode int, stdout, stderr string)
- func Main(t testing.TB, args []string, stdin io.Reader, main MainFunc) (exitCode int, stdout, stderr string)
- func Mkdir(t testing.TB, path string)
- func MkdirTemp(t testing.TB) string
- func WriteFile(t testing.TB, filename string, data []byte)
- type MainFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.