mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Add support for splitting a test file. (#2876)
I'm looking at this as I start thinking about handling `import`. Syntax is based on llvm's `split-file` tool. The `std::vector` -> `llvm::SmallVector` switch is minor, I'm doing it here because I had to touch everything anyways and I think for tests I'll lean slightly more towards the toolchain's way of doing things versus explorer's.
This commit is contained in:
+10
-3
@@ -32,8 +32,15 @@ class ParseAndExecuteTestFile : public FileTestBase {
|
||||
}
|
||||
}
|
||||
|
||||
auto RunOverFile(llvm::raw_ostream& stdout, llvm::raw_ostream& stderr)
|
||||
auto RunWithFiles(const llvm::SmallVector<std::string>& test_files,
|
||||
llvm::raw_ostream& stdout, llvm::raw_ostream& stderr)
|
||||
-> bool override {
|
||||
if (test_files.size() != 1) {
|
||||
ADD_FAILURE() << "Only 1 file is supported: " << test_files.size()
|
||||
<< " provided";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Capture trace streaming, but only when in debug mode.
|
||||
TraceStream trace_stream;
|
||||
std::string trace_stream_str;
|
||||
@@ -74,8 +81,8 @@ class ParseAndExecuteTestFile : public FileTestBase {
|
||||
|
||||
} // namespace
|
||||
|
||||
extern auto RegisterFileTests(const std::vector<std::filesystem::path>& paths)
|
||||
-> void {
|
||||
extern auto RegisterFileTests(
|
||||
const llvm::SmallVector<std::filesystem::path>& paths) -> void {
|
||||
ParseAndExecuteTestFile::RegisterTests(
|
||||
"ParseAndExecuteTestFile", paths, [=](const std::filesystem::path& path) {
|
||||
return new ParseAndExecuteTestFile(path, /*trace=*/false);
|
||||
|
||||
Reference in New Issue
Block a user