Parse cpp_namespace

This commit is contained in:
Jonathan Müller 2017-02-22 10:33:27 +01:00
commit 7e1ef01105
2 changed files with 10 additions and 2 deletions

View file

@ -41,8 +41,7 @@ namespace c
}
else if (ns.name() == "d")
{
REQUIRE(ns.parent());
REQUIRE(ns.parent().value().name() == "c");
check_parent(ns, "c", "c::d");
REQUIRE(!ns.is_inline());
REQUIRE(no_children == 0u);
}

View file

@ -62,4 +62,13 @@ unsigned count_children(const Entity& cont)
return std::distance(cont.begin(), cont.end());
}
// checks the full name/parent
inline void check_parent(const cppast::cpp_entity& e, const char* parent_name,
const char* full_name)
{
REQUIRE(e.parent());
REQUIRE(e.parent().value().name() == parent_name);
REQUIRE(cppast::full_name(e) == full_name);
}
#endif // CPPAST_TEST_PARSER_HPP_INCLUDED