summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/unittests/clang-tidy/GoogleModuleTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/unittests/clang-tidy/GoogleModuleTest.cpp')
-rw-r--r--clang-tools-extra/unittests/clang-tidy/GoogleModuleTest.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/clang-tools-extra/unittests/clang-tidy/GoogleModuleTest.cpp b/clang-tools-extra/unittests/clang-tidy/GoogleModuleTest.cpp
new file mode 100644
index 00000000000..26b85b929d6
--- /dev/null
+++ b/clang-tools-extra/unittests/clang-tidy/GoogleModuleTest.cpp
@@ -0,0 +1,26 @@
+#include "ClangTidyTest.h"
+
+#include "google/GoogleTidyModule.h"
+
+namespace clang {
+namespace tidy {
+
+typedef ClangTidyTest<ExplicitConstructorCheck> ExplicitConstructorCheckTest;
+
+TEST_F(ExplicitConstructorCheckTest, SingleArgumentConstructorsOnly) {
+ expectNoChanges("class C { C(); };");
+ expectNoChanges("class C { C(int i, int j); };");
+}
+
+TEST_F(ExplicitConstructorCheckTest, Basic) {
+ EXPECT_EQ("class C { explicit C(int i); };",
+ runCheckOn("class C { C(int i); };"));
+}
+
+TEST_F(ExplicitConstructorCheckTest, DefaultParameters) {
+ EXPECT_EQ("class C { explicit C(int i, int j = 0); };",
+ runCheckOn("class C { C(int i, int j = 0); };"));
+}
+
+} // namespace tidy
+} // namespace clang
OpenPOWER on IntegriCloud