mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-27 10:20:11 +01:00
Migrate remaining exits to FATAL_*_ERROR calls (#704)
Adds FATAL for things that are most likely programming errors in executable_semantics.
This commit is contained in:
@@ -9,28 +9,24 @@
|
||||
namespace Carbon {
|
||||
namespace {
|
||||
|
||||
TEST(ErrorTest, FatalUserError) {
|
||||
ASSERT_DEATH({ FATAL_RUNTIME_ERROR_NO_LINE() << "test"; }, "ERROR: test\n");
|
||||
TEST(ErrorTest, FatalProgramError) {
|
||||
ASSERT_DEATH({ FATAL_PROGRAM_ERROR_NO_LINE() << "test"; },
|
||||
"^PROGRAM ERROR: test\n");
|
||||
}
|
||||
|
||||
TEST(ErrorTest, FatalRuntimeError) {
|
||||
ASSERT_DEATH({ FATAL_RUNTIME_ERROR_NO_LINE() << "test"; },
|
||||
"RUNTIME ERROR: test\n");
|
||||
"^RUNTIME ERROR: test\n");
|
||||
}
|
||||
|
||||
TEST(ErrorTest, FatalCompilationError) {
|
||||
ASSERT_DEATH({ FATAL_COMPILATION_ERROR_NO_LINE() << "test"; },
|
||||
"COMPILATION ERROR: test\n");
|
||||
"^COMPILATION ERROR: test\n");
|
||||
}
|
||||
|
||||
TEST(ErrorTest, FatalUserErrorLine) {
|
||||
ASSERT_DEATH({ FATAL_USER_ERROR(1) << "test"; }, "ERROR: 1: test\n");
|
||||
}
|
||||
|
||||
auto NoReturnRequired() -> int { FATAL_USER_ERROR_NO_LINE() << "test"; }
|
||||
|
||||
TEST(ErrorTest, NoReturnRequired) {
|
||||
ASSERT_DEATH({ NoReturnRequired(); }, "ERROR: test\n");
|
||||
TEST(ErrorTest, FatalProgramErrorLine) {
|
||||
ASSERT_DEATH({ FATAL_PROGRAM_ERROR(1) << "test"; },
|
||||
"^PROGRAM ERROR: 1: test\n");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user