| 1 | // Copyright Jason Rice 2016 |
|---|---|
| 2 | // Distributed under the Boost Software License, Version 1.0. |
| 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) |
| 4 | |
| 5 | #include <boost/hana/assert.hpp> |
| 6 | #include <boost/hana/experimental/printable.hpp> |
| 7 | #include <boost/hana/integral_constant.hpp> |
| 8 | #include <boost/hana/type.hpp> |
| 9 | |
| 10 | #include <regex> |
| 11 | #include <sstream> |
| 12 | namespace hana = boost::hana; |
| 13 | |
| 14 | namespace foo { |
| 15 | template <typename T> struct my_template { }; |
| 16 | template <typename ...> struct my_mf { struct type; }; |
| 17 | struct my_mf_class { template <typename ...> struct apply { struct type; }; }; |
| 18 | } |
| 19 | |
| 20 | int main() { |
| 21 | { |
| 22 | std::ostringstream ss; |
| 23 | ss << hana::experimental::print( |
| 24 | hana::template_<foo::my_template> |
| 25 | ); |
| 26 | BOOST_HANA_RUNTIME_CHECK(std::regex_match(ss.str(), |
| 27 | std::regex("template<(?:struct )?foo::my_template>"))); |
| 28 | } |
| 29 | { |
| 30 | std::ostringstream ss; |
| 31 | ss << hana::experimental::print( |
| 32 | hana::metafunction<foo::my_mf> |
| 33 | ); |
| 34 | BOOST_HANA_RUNTIME_CHECK(std::regex_match(ss.str(), |
| 35 | std::regex("metafunction<(?:struct )?foo::my_mf>"))); |
| 36 | } |
| 37 | { |
| 38 | std::ostringstream ss; |
| 39 | ss << hana::experimental::print( |
| 40 | hana::metafunction_class<foo::my_mf_class> |
| 41 | ); |
| 42 | BOOST_HANA_RUNTIME_CHECK(std::regex_match(ss.str(), |
| 43 | std::regex("metafunction_class<(?:struct )?foo::my_mf_class>"))); |
| 44 | } |
| 45 | } |
| 46 |
