c++ - Do I have to delete/release GetCapturedStdOut when using google test? -
i have following simple test
test_f(mytest, outputcomparetest) { capturestderr(); capturestdout(); std::string actualoutput = testing::internal::getcapturedstdout(); std::string matchingsample = "some string compare output"; expect_eq(actualoutput, matchingsample); expect_eq(getcapturedstderr(), ""); }
the question here have release/delete captured buffer in order not keep forever , other test can recapture output without problem.
i have been looking in googletest docs seems there not predefined function releases captured buffer capturestderr() , capturestdout(). mean lifetime of objects limited lifetime of test? may have missed not indicated in documentation.
partially indicated fact can't assign pointer it.
std::string* actualoutput = &testing::internal::getcapturedstdout(); ... delete actualoutput; actualoutput = nullptr;
because getcapturedstdout seems me non lvalue. want sure don't have delete , if how it.
Comments
Post a Comment