mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +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:
@@ -2,7 +2,7 @@
|
||||
# Exceptions. See /LICENSE for license information.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
@@ -10,7 +10,48 @@ cc_binary(
|
||||
name = "cpp_refactoring",
|
||||
srcs = ["main.cpp"],
|
||||
deps = [
|
||||
"@llvm-project//clang:ast_matchers",
|
||||
":fn_inserter",
|
||||
"@llvm-project//clang:tooling",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "fn_inserter",
|
||||
srcs = ["fn_inserter.cpp"],
|
||||
hdrs = ["fn_inserter.h"],
|
||||
deps = [":matcher"],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "fn_inserter_test",
|
||||
srcs = ["fn_inserter_test.cpp"],
|
||||
deps = [
|
||||
":fn_inserter",
|
||||
":matcher_test_base",
|
||||
"@llvm-project//clang:tooling",
|
||||
"@llvm-project//llvm:gtest_main",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "matcher",
|
||||
srcs = ["matcher.cpp"],
|
||||
hdrs = ["matcher.h"],
|
||||
deps = [
|
||||
"@llvm-project//clang:ast_matchers",
|
||||
"@llvm-project//clang:tooling_core",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "matcher_test_base",
|
||||
testonly = 1,
|
||||
srcs = ["matcher_test_base.cpp"],
|
||||
hdrs = ["matcher_test_base.h"],
|
||||
deps = [
|
||||
"@llvm-project//clang:ast_matchers",
|
||||
"@llvm-project//clang:tooling",
|
||||
"@llvm-project//llvm:gmock",
|
||||
"@llvm-project//llvm:gtest",
|
||||
],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user