| 30 | constexpr int ErrorMsg::MAX_ERROR_MESSAGE_LEN; |
| 31 | |
| 32 | TEST(ErrorMsg, GenericFormatting) { |
| 33 | ErrorMsg msg(TErrorCode::GENERAL, "This is a test"); |
| 34 | ASSERT_EQ("This is a test", msg.msg()); |
| 35 | |
| 36 | msg.AddDetail("Detail come here."); |
| 37 | msg.AddDetail("Or here."); |
| 38 | ASSERT_EQ("This is a test\nDetail come here.\nOr here.\n", |
| 39 | msg.GetFullMessageDetails()); |
| 40 | |
| 41 | msg = ErrorMsg(TErrorCode::MISSING_BUILTIN, "fun", "sym"); |
| 42 | ASSERT_EQ("Builtin 'fun' with symbol 'sym' does not exist. Verify that " |
| 43 | "all your impalads are the same version.", msg.msg()); |
| 44 | |
| 45 | // Test long error message and truncation. |
| 46 | string long_msg = std::string(256 * 1024, '-'); // 256kb string |
| 47 | msg = ErrorMsg(TErrorCode::GENERAL, long_msg); |
| 48 | ASSERT_EQ(ErrorMsg::MAX_ERROR_MESSAGE_LEN, msg.msg().size()); |
| 49 | } |
| 50 | |
| 51 | TEST(ErrorMsg, MergeMap) { |
| 52 | ErrorLogMap left, right; |
nothing calls this directly
no test coverage detected