mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 07:51:05 +01:00
Track the file kind on SourceLocation rather than computing it from the file name. (#2999)
This will be more correct if a user file is named prelude.carbon, and reduces the explorer runtime by about 10% by removing a string comparison from the check for whether trace output is enabled. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
41e357492b
commit
ea60e4f491
@@ -11,6 +11,7 @@ namespace Carbon::Testing {
|
||||
namespace {
|
||||
|
||||
using ::testing::Eq;
|
||||
using ::testing::MatchesRegex;
|
||||
|
||||
TEST(ParseAndExecuteTest, Recursion) {
|
||||
std::string source = R"(
|
||||
@@ -36,9 +37,10 @@ TEST(ParseAndExecuteTest, Recursion) {
|
||||
ParseAndExecute("explorer/data/prelude.carbon", "test.carbon", source,
|
||||
/*parser_debug=*/false, &trace_stream, &llvm::nulls());
|
||||
ASSERT_FALSE(err.ok());
|
||||
// Don't expect any particular source location for the error.
|
||||
EXPECT_THAT(err.error().message(),
|
||||
Eq("RUNTIME ERROR: overflow:1: stack overflow: too many "
|
||||
"interpreter actions on stack"));
|
||||
MatchesRegex("RUNTIME ERROR:.* stack overflow: too many "
|
||||
"interpreter actions on stack"));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user