From 25746b2036b86dffe74a320f1c383b8a03c29db5 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Tue, 28 May 2019 13:48:45 +1000 Subject: [PATCH] test/introspection: add more templated type_name tests --- test/introspection.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/test/introspection.cpp b/test/introspection.cpp index 8f25b5df..7e097c9f 100644 --- a/test/introspection.cpp +++ b/test/introspection.cpp @@ -22,6 +22,21 @@ namespace bar { } +/////////////////////////////////////////////////////////////////////////////// +template +struct templated_with_type { ValueT inner; }; + + +template +struct templated_with_value { }; + + +enum enumeration_t { FOO }; + +template +struct templated_with_enum { }; + + /////////////////////////////////////////////////////////////////////////////// // define introspection data namespace cruft @@ -79,5 +94,23 @@ int main () tap.expect_eq (cruft::view (cruft::type_name ()), "foo", "struct type_name"); tap.expect_eq (cruft::view (cruft::type_name ()), "qux", "namespaced struct type_name"); + tap.expect_eq ( + cruft::type_name> (), + std::string_view {"templated_with_type"}, + "templated_with_type" + ); + + tap.expect_eq ( + cruft::type_name> (), + std::string_view {"templated_with_value<-1>"}, + "templated_with_value" + ); + + tap.expect_eq ( + cruft::type_name> (), + std::string_view {"templated_with_enum"}, + "templated_with_enum" + ); + return tap.status (); }