mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +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
+3
-11
@@ -3,7 +3,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
#include "absl/flags/flag.h"
|
||||
#include "common/check.h"
|
||||
#include "explorer/main.h"
|
||||
#include "testing/file_test/file_test_base.h"
|
||||
#include "testing/util/test_raw_ostream.h"
|
||||
@@ -16,10 +15,9 @@ ABSL_FLAG(bool, trace, false,
|
||||
namespace Carbon::Testing {
|
||||
namespace {
|
||||
|
||||
class ParseAndExecuteTestFile : public FileTestBase {
|
||||
class ExplorerFileTest : public FileTestBase {
|
||||
public:
|
||||
explicit ParseAndExecuteTestFile(const std::filesystem::path& path)
|
||||
: FileTestBase(path) {}
|
||||
using FileTestBase::FileTestBase;
|
||||
|
||||
auto RunWithFiles(const llvm::SmallVector<llvm::StringRef>& test_args,
|
||||
const llvm::SmallVector<TestFile>& test_files,
|
||||
@@ -89,12 +87,6 @@ class ParseAndExecuteTestFile : public FileTestBase {
|
||||
|
||||
} // namespace
|
||||
|
||||
extern auto RegisterFileTests(
|
||||
const llvm::SmallVector<std::filesystem::path>& paths) -> void {
|
||||
ParseAndExecuteTestFile::RegisterTests(
|
||||
"ParseAndExecuteTestFile", paths, [](const std::filesystem::path& path) {
|
||||
return new ParseAndExecuteTestFile(path);
|
||||
});
|
||||
}
|
||||
CARBON_FILE_TEST_FACTORY(ExplorerFileTest);
|
||||
|
||||
} // namespace Carbon::Testing
|
||||
|
||||
Reference in New Issue
Block a user