matcher_test_base.h 924 B

123456789101112131415161718192021222324252627
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #ifndef MIGRATE_CPP_CPP_REFACTORING_MATCHER_TEST_BASE_H_
  5. #define MIGRATE_CPP_CPP_REFACTORING_MATCHER_TEST_BASE_H_
  6. #include "clang/ASTMatchers/ASTMatchFinder.h"
  7. #include "clang/Tooling/Core/Replacement.h"
  8. #include "gmock/gmock.h"
  9. #include "gtest/gtest.h"
  10. namespace Carbon {
  11. class MatcherTestBase : public ::testing::Test {
  12. protected:
  13. // Expects that that the replacements produced by running the finder result in
  14. // the specified code transformation.
  15. void ExpectReplacement(llvm::StringRef before, llvm::StringRef after);
  16. std::map<std::string, clang::tooling::Replacements> replacements;
  17. clang::ast_matchers::MatchFinder finder;
  18. };
  19. } // namespace Carbon
  20. #endif // MIGRATE_CPP_CPP_REFACTORING_MATCHER_TEST_BASE_H_