Пример #1
0
TEST(FriendDecl, FriendInlineFunctionLocation) {
  LocationVerifier<FriendDecl> Verifier;
  Verifier.expectLocation(2, 19);
  EXPECT_TRUE(Verifier.match("struct A {\n"
                             "int inline friend f() { return 0; }"
                             "};\n",
                             friendDecl()));
}
Пример #2
0
TEST(FriendDecl, FriendElaboratedTypeLocation) {
  LocationVerifier<FriendDecl> Verifier;
  Verifier.expectLocation(2, 8);
  EXPECT_TRUE(Verifier.match("struct A {\n"
                             "friend class B;\n"
                             "};\n",
                             friendDecl()));
}
Пример #3
0
TEST(FriendDecl, FriendConstructorDestructorLocation) {
  const std::string Code = "struct B {\n"
                           "B();\n"
                           "~B();\n"
                           "};\n"
                           "struct A {\n"
                           "friend B::B(), B::~B();\n"
                           "};\n";
  LocationVerifier<FriendDecl> ConstructorVerifier;
  ConstructorVerifier.expectLocation(6, 11);
  EXPECT_TRUE(ConstructorVerifier.match(
      Code, friendDecl(has(constructorDecl(ofClass(hasName("B")))))));
  LocationVerifier<FriendDecl> DestructorVerifier;
  DestructorVerifier.expectLocation(6, 19);
  EXPECT_TRUE(DestructorVerifier.match(
      Code, friendDecl(has(destructorDecl(ofClass(hasName("B")))))));
}
Пример #4
0
TEST(FriendDecl, FriendNonMemberFunctionDefinitionLocation) {
  LocationVerifier<FriendDecl> Verifier;
  Verifier.expectLocation(2, 12);
  EXPECT_TRUE(Verifier.match("struct A {\n"
                             "friend int f() { return 0; }\n"
                             "};\n",
                             friendDecl()));
}
Пример #5
0
TEST(FriendDecl, FriendNonMemberFunctionLocation) {
  LocationVerifier<FriendDecl> Verifier;
  Verifier.expectLocation(2, 13);
  EXPECT_TRUE(Verifier.match("struct A {\n"
                             "friend void f();\n"
                             "};\n",
                             friendDecl()));
}
Пример #6
0
TEST(FriendDecl, FriendTemplateClassLocation) {
  LocationVerifier<FriendDecl> Verifier;
  Verifier.expectLocation(3, 14);
  EXPECT_TRUE(Verifier.match("struct A {\n"
                             "template <typename T>\n"
                             "friend class B;\n"
                             "};\n",
                             friendDecl()));
}
Пример #7
0
TEST(FriendDecl, FriendTemplateFunctionLocation) {
  LocationVerifier<FriendDecl> Verifier;
  Verifier.expectLocation(3, 13);
  EXPECT_TRUE(Verifier.match("struct A {\n"
                             "template <typename T>\n"
                             "friend void f();\n"
                             "};\n",
                             friendDecl()));
}
Пример #8
0
TEST(FriendDecl, FriendTemplateParameterLocation) {
  LocationVerifier<FriendDecl> Verifier;
  Verifier.expectLocation(3, 8);
  EXPECT_TRUE(Verifier.match("template <typename T>\n"
                             "struct A {\n"
                             "friend T;\n"
                             "};\n",
                             friendDecl(), Lang_CXX11));
}
Пример #9
0
TEST(FriendDecl, FriendSimpleTypeLocation) {
  LocationVerifier<FriendDecl> Verifier;
  Verifier.expectLocation(3, 8);
  EXPECT_TRUE(Verifier.match("class B;\n"
                             "struct A {\n"
                             "friend B;\n"
                             "};\n",
                             friendDecl(), Lang_CXX11));
}
Пример #10
0
TEST(FriendDecl, FriendDecltypeLocation) {
  LocationVerifier<FriendDecl> Verifier;
  Verifier.expectLocation(4, 8);
  EXPECT_TRUE(Verifier.match("struct A;\n"
                             "A foo();\n"
                             "struct A {\n"
                             "friend decltype(foo());\n"
                             "};\n",
                             friendDecl(), Lang_CXX11));
}
Пример #11
0
TEST(ParmVarDecl, KNRLocation) {
  LocationVerifier<ParmVarDecl> Verifier;
  Verifier.expectLocation(1, 8);
  EXPECT_TRUE(Verifier.match("void f(i) {}", varDecl(), Lang_C));
}
Пример #12
0
TEST(LocationVerifier, WrongLocation) {
  LocationVerifier<VarDecl> Verifier;
  Verifier.expectLocation(1, 1);
  EXPECT_FALSE(Verifier.match("int i;", varDecl()));
}
Пример #13
0
TEST(MatchVerifier, WrongType) {
  LocationVerifier<RecordDecl> Verifier;
  Verifier.expectLocation(1, 1);
  EXPECT_FALSE(Verifier.match("int i;", varDecl()));
}
Пример #14
0
TEST(MatchVerifier, NoMatch) {
  LocationVerifier<VarDecl> Verifier;
  Verifier.expectLocation(1, 1);
  EXPECT_FALSE(Verifier.match("int i;", recordDecl()));
}
Пример #15
0
TEST(MatchVerifier, ParseError) {
  LocationVerifier<VarDecl> Verifier;
  Verifier.expectLocation(1, 1);
  EXPECT_FALSE(Verifier.match("int i", varDecl()));
}