Added option (#define CAPTURE_STDERR)
if set then the DebugTrace calls only for failing tests are shown
This commit is contained in:
28
JGE/include/OutputCapturer.h
Normal file
28
JGE/include/OutputCapturer.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef OUTPUTCAPTURER_H
|
||||
#define OUTPUTCAPTURER_H
|
||||
|
||||
#if defined(QT_CONFIG)
|
||||
#include <Qt>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
class OutputCapturer
|
||||
{
|
||||
private:
|
||||
static std::ostringstream stream;
|
||||
public:
|
||||
static void add(const std::string& s) {
|
||||
stream << s << "\n";
|
||||
}
|
||||
static void debugAndClear() {
|
||||
stream.flush();
|
||||
qDebug("%s", stream.str().c_str());
|
||||
stream.str("");
|
||||
}
|
||||
static void clear() {
|
||||
stream.str("");
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // OUTPUTCAPTURER_H
|
||||
Reference in New Issue
Block a user