How to send custom message in Google C++ Testing Framework?

后端 未结 6 1758
闹比i
闹比i 2020-12-22 20:59

I use Google C++ Testing Framework for unit testing of my code. I use Eclipse CDT with C++ Unit testing module for output analysis.

Previously I used CppUnit it ha

6条回答
  •  旧巷少年郎
    2020-12-22 21:24

    You should define the below:

    static class LOGOUT {
    public:
        LOGOUT() {}
        std::ostream&  info() {
            std::cout << "[info      ] ";
            return std::cout;
        }
    
    } logout;
    

    using this:

    logout.info() << "test: " << "log" << std::endl;
    

提交回复
热议问题