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

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

.htaccess - ERR_TOO_MANY_REDIRECTS htaccess -