Switch FileTest to use StringRefs instead of files. (#2885)

In explorer, we already support parsing a string_view, so use that. In toolchain, we need to build support, probably using vfs, so that's a todo.

bazel test //explorer:file_test --runs_per_test=5

- branch: Stats over 250 runs: max = 18.3s, min = 5.2s, avg = 11.2s, dev = 2.9s
- trunk: Stats over 250 runs: max = 22.3s, min = 5.9s, avg = 12.1s, dev = 2.8s

Not a dramatic improvement, but maybe more effective long-term, and this'd been requested on #2876
This commit is contained in:
Jon Ross-Perkins
2023-06-09 09:05:27 -07:00
committed by GitHub
parent 00232846f8
commit c43839e1b1
13 changed files with 176 additions and 140 deletions
@@ -31,7 +31,10 @@ TEST(ParseAndExecuteTest, Recursion) {
;
}
)";
auto err = ParseAndExecute("explorer/data/prelude.carbon", source);
TraceStream trace_stream;
auto err =
ParseAndExecute("explorer/data/prelude.carbon", "test.carbon", source,
/*parser_debug=*/false, &trace_stream, &llvm::nulls());
ASSERT_FALSE(err.ok());
EXPECT_THAT(err.error().message(),
Eq("RUNTIME ERROR: overflow:1: stack overflow: too many "