0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 12:12:15 +02:00
openvpn3/test/unittests/test_pipe.cpp
James Yonan eb8ab4c0c9 [test/misc] Updated system_cmd() calls to reflect newly added sigset_t* parameter
Signed-off-by: James Yonan <james@openvpn.net>
2022-07-01 15:57:30 +02:00

25 lines
731 B
C++

#include "test_common.h"
#include <openvpn/common/string.hpp>
#include <openvpn/common/process.hpp>
using namespace openvpn;
TEST(misc, pipe) {
RedirectPipe::InOut io;
{
Argv argv;
io.in = "one\ntwo\nthree\nfour\nfive\nsix\nseven\neight\nnine\nten\n";
argv.emplace_back("sort");
argv.emplace_back("-u");
//OPENVPN_LOG(argv.to_string());
const int status = system_cmd("/usr/bin/sort", argv, nullptr, io, 0, nullptr);
ASSERT_EQ(0, status) << "bad sort status=" << status << " stderr=" << io.err;
const std::string expected = "eight\nfive\nfour\nnine\none\nseven\nsix\nten\nthree\ntwo\n";
ASSERT_EQ (io.out, expected) << "bad sort EXPECTED:\n" << expected << "ACTUAL:\n" << io.out;
}
}