// time in output (for recorders that need it) void ErrorTestObject::test<9>() { LLError::setTimeFunction(roswell); mRecorder.setWantsTime(false); ufoSighting(); ensure_message_contains(0, "ufo"); ensure_message_does_not_contain(0, roswell()); mRecorder.setWantsTime(true); ufoSighting(); ensure_message_contains(1, "ufo"); ensure_message_contains(1, roswell()); }
// multiple recorders void ErrorTestObject::test<11>() { TestRecorder altRecorder; LLError::addRecorder(&altRecorder); llinfos << "boo" << llendl; ensure_message_contains(0, "boo"); ensure_equals("alt recorder count", altRecorder.countMessages(), 1); ensure_contains("alt recorder message 0", altRecorder.message(0), "boo"); LLError::setTimeFunction(roswell); TestRecorder anotherRecorder; anotherRecorder.setWantsTime(true); LLError::addRecorder(&anotherRecorder); llinfos << "baz" << llendl; std::string when = roswell(); ensure_message_does_not_contain(1, when); ensure_equals("alt recorder count", altRecorder.countMessages(), 2); ensure_does_not_contain("alt recorder message 1", altRecorder.message(1), when); ensure_equals("another recorder count", anotherRecorder.countMessages(), 1); ensure_contains("another recorder message 0", anotherRecorder.message(0), when); }
// output order void ErrorTestObject::test<10>() { LLError::setPrintLocation(true); LLError::setTimeFunction(roswell); mRecorder.setWantsTime(true); std::string locationAndFunction = writeReturningLocationAndFunction(); ensure_equals("order is time type location function message", mRecorder.message(0), roswell() + " INFO: " + locationAndFunction + ": apple"); }
// output order void ErrorTestObject::test<10>() { #if LL_LINUX skip("Fails on Linux, see comments"); // on Linux: // [error, 10] fail: 'order is time type location function message: expected // '1947-07-08T03:04:05Z INFO: llcommon/tests/llerror_test.cpp(268) : // writeReturningLocationAndFunction: apple' actual // '1947-07-08T03:04:05Z INFO: llcommon/tests/llerror_test.cpp(268) : // LLError::NoClassInfo::writeReturningLocationAndFunction: apple'' #endif LLError::setPrintLocation(true); LLError::setTimeFunction(roswell); mRecorder.setWantsTime(true); std::string locationAndFunction = writeReturningLocationAndFunction(); ensure_equals("order is time type location function message", mRecorder.message(0), roswell() + " INFO: " + locationAndFunction + ": apple"); }