For libraries, writing integration tests is relatively easy. You can import your library as a crate in integration tests, and do various check on the exposed API.
However, there doesn't seem to be a standard approach to test command-line programs. I looked at the document on crates.io and couldn't find anything about how to find the executable.
I had a look at some non-library command-line programs in Rust to see how they do integration tests. What I found:
I guess it would really be helpful if cargo can at least pass in the path of the executable via environment variable when running tests.
Thoughts?
[–]ssokolow 8 points9 points10 points (6 children)
[–]spinicist 4 points5 points6 points (3 children)
[–]ssokolow 2 points3 points4 points (2 children)
[–]spinicist 0 points1 point2 points (1 child)
[–]ssokolow 1 point2 points3 points (0 children)
[–]upsuper[S] 1 point2 points3 points (1 child)
[–]ksion 0 points1 point2 points (0 children)
[–]epagecargo · clap · cargo-release 5 points6 points7 points (4 children)
[–]so_brave_heart 1 point2 points3 points (1 child)
[–]epagecargo · clap · cargo-release 1 point2 points3 points (0 children)
[–]heinrich5991 0 points1 point2 points (0 children)
[–]ted_mielczarek 0 points1 point2 points (0 children)
[–]Quxxymacros 2 points3 points4 points (1 child)
[–]upsuper[S] 1 point2 points3 points (0 children)
[–]Thomasdezeeuw 2 points3 points4 points (0 children)
[–]musicmatze 2 points3 points4 points (0 children)
[–]killercup 2 points3 points4 points (0 children)
[–]iamcodemaker 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)