stdiotest is a testing utility which tests the stdout output of a given program with specified stdin. It also supports running the tests in parallel to improve efficiency.
How to use
- Install the cli tool:
go install github.com/GalvinGao/stdiotest@latest
- Create a
stdiotest.yamlfile in the root of your project. The file should look like this:
test_cases: - cmd: "./main" exit_code: 0 stdin: "Galvin" stdout: | Hello, Galvin! - cmd: "./main" exit_code: 0 stdin: "Alice" stdout: | Hello, Alice! - cmd: "./main" exit_code: 1 stdin: "Bob" stdout: | Bob is not allowed to use this program.-
stdiotest runin the root of your project.
stdiotest help for more information.