From 851b6a097165af4d51c0db01b5e05256e5006896 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:00:48 +0200 Subject: Adding upstream version 2.6.1. Signed-off-by: Daniel Baumann --- test/libapt/teestream_test.cc | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 test/libapt/teestream_test.cc (limited to 'test/libapt/teestream_test.cc') diff --git a/test/libapt/teestream_test.cc b/test/libapt/teestream_test.cc new file mode 100644 index 0000000..a897e08 --- /dev/null +++ b/test/libapt/teestream_test.cc @@ -0,0 +1,39 @@ +#include + +#include "../interactive-helper/teestream.h" +#include +#include +#include + +#include + +TEST(TeeStreamTest,TwoStringSinks) +{ + std::ostringstream one, two; + basic_teeostream tee(one, two); + tee << "This is the " << 1 << '.' << " Test, we expect: " << std::boolalpha << true << "\n"; + std::string okay("This is the 1. Test, we expect: true\n"); + EXPECT_EQ(okay, one.str()); + EXPECT_EQ(okay, two.str()); + EXPECT_EQ(one.str(), two.str()); +} + +TEST(TeeStreamTest,DevNullSink1) +{ + std::ostringstream one; + std::fstream two("/dev/null"); + basic_teeostream tee(one, two); + tee << "This is the " << 2 << '.' << " Test, we expect: " << std::boolalpha << false << "\n"; + std::string okay("This is the 2. Test, we expect: false\n"); + EXPECT_EQ(okay, one.str()); +} + +TEST(TeeStreamTest,DevNullSink2) +{ + std::ostringstream one; + std::fstream two("/dev/null"); + basic_teeostream tee(two, one); + tee << "This is the " << 3 << '.' << " Test, we expect: " << std::boolalpha << false << "\n"; + std::string okay("This is the 3. Test, we expect: false\n"); + EXPECT_EQ(okay, one.str()); +} -- cgit v1.2.3