Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
fix: cpp tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nambers committed Oct 23, 2023
1 parent aabc039 commit 1971c4a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion cpp/tests/plugin/MiraiCPNewThreadTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,4 @@ TEST(MiraiCPNewThreadTest, test) {
}

ASSERT_EQ(0, CheckNoMoreCopy(result, stdresult)); // fail, 0 != 1
ASSERT_FALSE(result.empty());
}
4 changes: 4 additions & 0 deletions cpp/tests/plugin/RedirectStandardOutputTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ using namespace MiraiCP;

TEST(RedirectStandardOutputForPluginTest, COUT) {
MiraiCP::Redirector::setRedirectedObjs(&std::cout, &std::cerr);
MiraiCP::Redirector::start();
std::string re;
MiraiCP::Logger::logger.registerHandle([&re](const std::string &str, int level) {
if (level == 0) re += str;
Expand All @@ -29,11 +30,13 @@ using namespace MiraiCP;
std::cout << "aabb";
std::cout.flush();
std::cout << "111" << std::endl;
MiraiCP::Redirector::reset();
ASSERT_EQ("testaabb111\n", re);
}

TEST(RedirectStandardOutputForPluginTest, CERR) {
MiraiCP::Redirector::setRedirectedObjs(&std::cout, &std::cerr);
MiraiCP::Redirector::start();
std::string re;
MiraiCP::Logger::logger.registerHandle([&re](const std::string &str, int level) {
if (level == 2) re += str;
Expand All @@ -42,5 +45,6 @@ using namespace MiraiCP;
std::cerr << "aabb";
std::cerr.flush();
std::cerr << "111" << std::endl;
MiraiCP::Redirector::reset();
ASSERT_EQ("testaabb111\n", re);
}

0 comments on commit 1971c4a

Please sign in to comment.