From 5920766f2095b61446b012ad0455050be017f8ee Mon Sep 17 00:00:00 2001 From: Rajat Jain <1997.rajatjain@gmail.com> Date: Tue, 21 Sep 2021 18:44:12 +0530 Subject: [PATCH] Added more test cases --- test/source/subprocess_test.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/source/subprocess_test.cpp b/test/source/subprocess_test.cpp index 8ec206a..70168c7 100644 --- a/test/source/subprocess_test.cpp +++ b/test/source/subprocess_test.cpp @@ -60,7 +60,7 @@ TEST_CASE("_cmd literal + string chaining") CHECK_EQ(errc, 0); } -TEST_CASE("bash-like redirection") +TEST_CASE("bash-like redirection - stderr to stdout") { using namespace subprocess::literals; std::string output; @@ -70,6 +70,15 @@ TEST_CASE("bash-like redirection") REQUIRE(not output.empty()); } +TEST_CASE("bash-like redirection - stdout to stderr") +{ + using namespace subprocess::literals; + std::string output; + int errc = ("echo abc"_cmd >= output > subprocess::err).run(std::nothrow); + REQUIRE_EQ(errc, 0); + REQUIRE(output == "abc\n"); +} + TEST_CASE("SIGPIPE handling for child processes") { using namespace subprocess::literals;