Ejemplo n.º 1
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()));
}
Ejemplo n.º 2
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()));
}
Ejemplo n.º 3
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));
}
Ejemplo n.º 4
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));
}
Ejemplo n.º 5
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));
}
Ejemplo n.º 6
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")))))));
}
Ejemplo n.º 7
0
TEST(ParmVarDecl, KNRLocation) {
  LocationVerifier<ParmVarDecl> Verifier;
  Verifier.expectLocation(1, 8);
  EXPECT_TRUE(Verifier.match("void f(i) {}", varDecl(), Lang_C));
}
Ejemplo n.º 8
0
TEST(LocationVerifier, WrongLocation) {
  LocationVerifier<VarDecl> Verifier;
  Verifier.expectLocation(1, 1);
  EXPECT_FALSE(Verifier.match("int i;", varDecl()));
}
Ejemplo n.º 9
0
TEST(MatchVerifier, WrongType) {
  LocationVerifier<RecordDecl> Verifier;
  Verifier.expectLocation(1, 1);
  EXPECT_FALSE(Verifier.match("int i;", varDecl()));
}
Ejemplo n.º 10
0
TEST(MatchVerifier, NoMatch) {
  LocationVerifier<VarDecl> Verifier;
  Verifier.expectLocation(1, 1);
  EXPECT_FALSE(Verifier.match("int i;", recordDecl()));
}
Ejemplo n.º 11
0
TEST(MatchVerifier, ParseError) {
  LocationVerifier<VarDecl> Verifier;
  Verifier.expectLocation(1, 1);
  EXPECT_FALSE(Verifier.match("int i", varDecl()));
}