blob: 48433f4fbd8013c8ddb60d96e4d2bf328fa5cf0e [file] [log] [blame]
Daniel Jasperd07c8402013-07-29 08:19:24 +00001#include "ClangTidyTest.h"
Daniel Jasperd07c8402013-07-29 08:19:24 +00002#include "google/GoogleTidyModule.h"
3
4namespace clang {
5namespace tidy {
6
7typedef ClangTidyTest<ExplicitConstructorCheck> ExplicitConstructorCheckTest;
8
9TEST_F(ExplicitConstructorCheckTest, SingleArgumentConstructorsOnly) {
10 expectNoChanges("class C { C(); };");
11 expectNoChanges("class C { C(int i, int j); };");
12}
13
14TEST_F(ExplicitConstructorCheckTest, Basic) {
15 EXPECT_EQ("class C { explicit C(int i); };",
16 runCheckOn("class C { C(int i); };"));
17}
18
19TEST_F(ExplicitConstructorCheckTest, DefaultParameters) {
20 EXPECT_EQ("class C { explicit C(int i, int j = 0); };",
21 runCheckOn("class C { C(int i, int j = 0); };"));
22}
23
Alexander Kornienko32eaa372014-02-13 10:11:48 +000024TEST_F(ExplicitConstructorCheckTest, OutOfLineDefinitions) {
25 EXPECT_EQ("class C { explicit C(int i); }; C::C(int i) {}",
26 runCheckOn("class C { C(int i); }; C::C(int i) {}"));
27}
28
Daniel Jasperd07c8402013-07-29 08:19:24 +000029} // namespace tidy
30} // namespace clang