summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/unittests/clang-tidy/GoogleModuleTest.cpp
blob: 26b85b929d6e77f7b1baf20db5b3761f87658a9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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