]>
git.saurik.com Git - apt.git/blob - test/libapt/teestream_test.cc
6 #include "../interactive-helper/teestream.h"
8 #include <gtest/gtest.h>
10 TEST(TeeStreamTest
,TwoStringSinks
)
12 std::ostringstream one
, two
;
13 basic_teeostream
<char> tee(one
, two
);
14 tee
<< "This is the " << 1 << '.' << " Test, we expect: " << std::boolalpha
<< true << "\n";
15 std::string
okay("This is the 1. Test, we expect: true\n");
16 EXPECT_EQ(okay
, one
.str());
17 EXPECT_EQ(okay
, two
.str());
18 EXPECT_EQ(one
.str(), two
.str());
21 TEST(TeeStreamTest
,DevNullSink1
)
23 std::ostringstream one
;
24 std::fstream
two("/dev/null");
25 basic_teeostream
<char> tee(one
, two
);
26 tee
<< "This is the " << 2 << '.' << " Test, we expect: " << std::boolalpha
<< false << "\n";
27 std::string
okay("This is the 2. Test, we expect: false\n");
28 EXPECT_EQ(okay
, one
.str());
31 TEST(TeeStreamTest
,DevNullSink2
)
33 std::ostringstream one
;
34 std::fstream
two("/dev/null");
35 basic_teeostream
<char> tee(two
, one
);
36 tee
<< "This is the " << 3 << '.' << " Test, we expect: " << std::boolalpha
<< false << "\n";
37 std::string
okay("This is the 3. Test, we expect: false\n");
38 EXPECT_EQ(okay
, one
.str());