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:
Jon Ross-Perkins
2023-08-01 16:00:29 +00:00
committed by GitHub
co-authored by Chandler Carruth
parent ce56226b73
commit eb05f618ce
10 changed files with 46 additions and 99 deletions
+1 -6
View File
@@ -2,11 +2,9 @@
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include <filesystem>
#include <string>
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "toolchain/driver/driver_file_test_base.h"
namespace Carbon::Testing {
@@ -23,9 +21,6 @@ class CodeGenFileTest : public DriverFileTestBase {
} // namespace
auto RegisterFileTests(const llvm::SmallVector<std::filesystem::path>& paths)
-> void {
CodeGenFileTest::RegisterTests<CodeGenFileTest>("CodeGenFileTest", paths);
}
CARBON_FILE_TEST_FACTORY(CodeGenFileTest);
} // namespace Carbon::Testing