mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 10:31:03 +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:
@@ -20,17 +20,21 @@ class ParserFileTest : public FileTestBase {
|
||||
explicit ParserFileTest(const std::filesystem::path& path)
|
||||
: FileTestBase(path) {}
|
||||
|
||||
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 {
|
||||
llvm::SmallVector<llvm::StringRef> args({"dump", "parse-tree"});
|
||||
for (const auto& file : test_files) {
|
||||
args.push_back(file);
|
||||
}
|
||||
Driver driver(stdout, stderr);
|
||||
return driver.RunFullCommand(
|
||||
{"dump", "parse-tree", path().filename().string()});
|
||||
return driver.RunFullCommand(args);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
auto RegisterFileTests(const std::vector<std::filesystem::path>& paths)
|
||||
auto RegisterFileTests(const llvm::SmallVector<std::filesystem::path>& paths)
|
||||
-> void {
|
||||
ParserFileTest::RegisterTests("ParserFileTest", paths,
|
||||
[](const std::filesystem::path& path) {
|
||||
|
||||
Reference in New Issue
Block a user