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:
Jon Ross-Perkins
2023-06-07 08:56:20 -07:00
committed by GitHub
parent 97de96eac6
commit 6586179c8d
12 changed files with 190 additions and 59 deletions
+10 -3
View File
@@ -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);