| 28 | void ThrowRuntimeError() { TVM_FFI_THROW(RuntimeError) << "test0"; } |
| 29 | |
| 30 | TEST(Error, Backtrace) { |
| 31 | EXPECT_THROW( |
| 32 | { |
| 33 | try { |
| 34 | ThrowRuntimeError(); |
| 35 | } catch (const Error& error) { |
| 36 | EXPECT_EQ(error.message(), "test0"); |
| 37 | EXPECT_EQ(error.kind(), "RuntimeError"); |
| 38 | std::string full_message = error.FullMessage(); |
| 39 | EXPECT_NE(full_message.find("line"), std::string::npos); |
| 40 | EXPECT_NE(full_message.find("ThrowRuntimeError"), std::string::npos); |
| 41 | EXPECT_NE(full_message.find("RuntimeError: test0"), std::string::npos); |
| 42 | throw; |
| 43 | } |
| 44 | }, |
| 45 | ::tvm::ffi::Error); |
| 46 | } |
| 47 | |
| 48 | TEST(CheckError, Backtrace) { |
| 49 | EXPECT_THROW( |
nothing calls this directly
no test coverage detected