mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 07:24:42 +01:00
Refactor FileTest construction so that the test class is directly available. (#3035)
This is a simplification of the construction, although somewhat limiting (it means that the caller can't register the same file multiple times, though I stopped doing that anyways since it was causing confusion). What this more importantly _allows_ is logic on the FileTestBase child itself that's not test-specific -- in particular, autoupdate functionality which wouldn't use RUN_ALL_TESTS. --------- Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
This commit is contained in:
co-authored by
Chandler Carruth
parent
ce56226b73
commit
eb05f618ce
@@ -24,8 +24,7 @@ using ::testing::Matcher;
|
||||
|
||||
class FileTestBaseTest : public FileTestBase {
|
||||
public:
|
||||
explicit FileTestBaseTest(const std::filesystem::path& path)
|
||||
: FileTestBase(path) {}
|
||||
using FileTestBase::FileTestBase;
|
||||
|
||||
static auto HasFilename(std::string filename) -> Matcher<TestFile> {
|
||||
return Field("filename", &TestFile::filename, Eq(filename));
|
||||
@@ -92,9 +91,6 @@ class FileTestBaseTest : public FileTestBase {
|
||||
|
||||
} // namespace
|
||||
|
||||
auto RegisterFileTests(const llvm::SmallVector<std::filesystem::path>& paths)
|
||||
-> void {
|
||||
FileTestBaseTest::RegisterTests<FileTestBaseTest>("FileTestBaseTest", paths);
|
||||
}
|
||||
CARBON_FILE_TEST_FACTORY(FileTestBaseTest);
|
||||
|
||||
} // namespace Carbon::Testing
|
||||
|
||||
Reference in New Issue
Block a user