mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 10:01:06 +01:00
Add tests to the cpp_refactoring tool. (#539)
This refactors the main.cpp out into a file structure that should make it easier to add more matchers/tests.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
#ifndef MIGRATE_CPP_CPP_REFACTORING_MATCHER_TEST_BASE_H_
|
||||
#define MIGRATE_CPP_CPP_REFACTORING_MATCHER_TEST_BASE_H_
|
||||
|
||||
#include "clang/ASTMatchers/ASTMatchFinder.h"
|
||||
#include "clang/Tooling/Core/Replacement.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace Carbon {
|
||||
|
||||
class MatcherTestBase : public ::testing::Test {
|
||||
protected:
|
||||
// Expects that that the replacements produced by running the finder result in
|
||||
// the specified code transformation.
|
||||
void ExpectReplacement(llvm::StringRef before, llvm::StringRef after);
|
||||
|
||||
std::map<std::string, clang::tooling::Replacements> replacements;
|
||||
clang::ast_matchers::MatchFinder finder;
|
||||
};
|
||||
|
||||
} // namespace Carbon
|
||||
|
||||
#endif // MIGRATE_CPP_CPP_REFACTORING_MATCHER_TEST_BASE_H_
|
||||
Reference in New Issue
Block a user