OpenVPN 3 Core Library
Loading...
Searching...
No Matches
test_pipe.cpp
Go to the documentation of this file.
1#include "test_common.hpp"
2
5
6using namespace openvpn;
7
8TEST(misc, pipe)
9{
11
12 {
13 Argv argv;
14 io.in = "one\ntwo\nthree\nfour\nfive\nsix\nseven\neight\nnine\nten\n";
15 argv.emplace_back("sort");
16 argv.emplace_back("-u");
17 // OPENVPN_LOG(argv.to_string());
18 const int status = system_cmd("/usr/bin/sort", argv, nullptr, io, 0, nullptr);
19
20 ASSERT_EQ(0, status) << "bad sort status=" << status << " stderr=" << io.err;
21
22 const std::string expected = "eight\nfive\nfour\nnine\none\nseven\nsix\nten\nthree\ntwo\n";
23 ASSERT_EQ(io.out, expected) << "bad sort EXPECTED:\n"
24 << expected << "ACTUAL:\n"
25 << io.out;
26 }
27}
int system_cmd(const std::string &cmd, const Argv &argv, RedirectBase *redir, const Environ *env, const sigset_t *sigmask)
Definition process.hpp:90
const std::string expected
TEST(misc, pipe)
Definition test_pipe.cpp:8