mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
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:
@@ -32,7 +32,7 @@ class ParseAndExecuteTestFile : public FileTestBase {
|
||||
}
|
||||
}
|
||||
|
||||
auto RunWithFiles(const llvm::SmallVector<std::string>& test_files,
|
||||
auto RunWithFiles(const llvm::SmallVector<TestFile>& test_files,
|
||||
llvm::raw_ostream& stdout, llvm::raw_ostream& stderr)
|
||||
-> bool override {
|
||||
if (test_files.size() != 1) {
|
||||
@@ -58,9 +58,9 @@ class ParseAndExecuteTestFile : public FileTestBase {
|
||||
|
||||
// Run the parse. Parser debug output is always off because it's difficult
|
||||
// to redirect.
|
||||
auto result =
|
||||
ParseAndExecuteFile(prelude_path, path().filename().string(),
|
||||
/*parser_debug=*/false, &trace_stream, &stdout);
|
||||
auto result = ParseAndExecute(
|
||||
prelude_path, test_files[0].filename, test_files[0].content,
|
||||
/*parser_debug=*/false, &trace_stream, &stdout);
|
||||
// This mirrors printing currently done by main.cpp.
|
||||
if (result.ok()) {
|
||||
stdout << "result: " << *result << "\n";
|
||||
|
||||
Reference in New Issue
Block a user