[tests] Rewrite resource loading test
Make it more readable and easier to debug.
This commit is contained in:
@@ -21,6 +21,12 @@ public:
|
||||
virtual bool onRecord(EventSeverity severity, Event event, int64_t code, const std::string &msg) = 0;
|
||||
};
|
||||
|
||||
class NullObserver : public Observer {
|
||||
bool onRecord(EventSeverity, Event, int64_t, const std::string&) override {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
static void setObserver(std::unique_ptr<Observer> Observer);
|
||||
static std::unique_ptr<Observer> removeObserver();
|
||||
|
||||
|
||||
@@ -22,6 +22,15 @@ inline std::string toString(int8_t num) {
|
||||
return boost::lexical_cast<std::string>(int(num));
|
||||
}
|
||||
|
||||
inline std::string toString(std::exception_ptr error) {
|
||||
try {
|
||||
std::rethrow_exception(error);
|
||||
} catch (const std::exception& ex) {
|
||||
return ex.what();
|
||||
} catch (...) {
|
||||
return "Unknown exception type";
|
||||
}
|
||||
}
|
||||
|
||||
template<size_t max, typename... Args>
|
||||
inline std::string sprintf(const char *msg, Args... args) {
|
||||
|
||||
Reference in New Issue
Block a user