From 7e1ef01105cf573dfde303351a7c75d619898ed8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Wed, 22 Feb 2017 10:33:27 +0100 Subject: [PATCH] Parse cpp_namespace --- test/cpp_namespace.cpp | 3 +-- test/test_parser.hpp | 9 +++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/test/cpp_namespace.cpp b/test/cpp_namespace.cpp index bb5d86a..f16c445 100644 --- a/test/cpp_namespace.cpp +++ b/test/cpp_namespace.cpp @@ -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); } diff --git a/test/test_parser.hpp b/test/test_parser.hpp index 20df54d..3b20139 100644 --- a/test/test_parser.hpp +++ b/test/test_parser.hpp @@ -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