mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-20 17:46:42 +00:00
Switch executable semantics to use ErrorBuilder directly and relocate macros (#1184)
This commit is contained in:
1 parent
6542506cdc
commit
87e58f5db3
37 files changed
+327
-376
No files matched your search
@@ -0,0 +1,30 @@
|
||||
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
#include "executable_semantics/common/error_builders.h"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "executable_semantics/common/source_location.h"
|
||||
|
||||
namespace Carbon::Testing {
|
||||
namespace {
|
||||
|
||||
TEST(ErrorBuildersTest, CompilationError) {
|
||||
Error err = CompilationError(SourceLocation("x", 1)) << "test";
|
||||
EXPECT_EQ(err.message(), "COMPILATION ERROR: x:1: test");
|
||||
}
|
||||
|
||||
TEST(ErrorBuildersTest, ProgramError) {
|
||||
Error err = ProgramError(SourceLocation("x", 1)) << "test";
|
||||
EXPECT_EQ(err.message(), "PROGRAM ERROR: x:1: test");
|
||||
}
|
||||
|
||||
TEST(ErrorBuildersTest, RuntimeError) {
|
||||
Error err = RuntimeError(SourceLocation("x", 1)) << "test";
|
||||
EXPECT_EQ(err.message(), "RUNTIME ERROR: x:1: test");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace Carbon::Testing
|
||||
Reference in new issue
Block a user