diff --git a/nano/core_test/object_stream.cpp b/nano/core_test/object_stream.cpp index 8cdf223470..c631cf476f 100644 --- a/nano/core_test/object_stream.cpp +++ b/nano/core_test/object_stream.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -313,24 +314,54 @@ TEST (object_stream, fmt_adapter) std::cout << std::endl; } -TEST (trace_logging, no_copy) +namespace +{ +struct non_copyable { - struct no_copyable + non_copyable () = default; + non_copyable (non_copyable const &) = delete; + non_copyable (non_copyable &&) = default; + non_copyable & operator= (non_copyable const &) = delete; + non_copyable & operator= (non_copyable &&) = default; + + friend std::ostream & operator<< (std::ostream & os, non_copyable const & nc) { - no_copyable () = default; - no_copyable (no_copyable const &) = delete; - no_copyable (no_copyable &&) = default; - no_copyable & operator= (no_copyable const &) = delete; - no_copyable & operator= (no_copyable &&) = default; + os << "non_copyable"; + return os; + } +}; +} + +TEST (trace_logging, no_copy) +{ + non_copyable nc; + + nano::logger logger; + logger.trace (nano::log::type::all, nano::log::detail::all, nano::log::arg{ "non_copyable", nc }); +} - void operator() (nano::object_stream & obs) const - { - obs.write ("test", "test"); - } - }; +namespace +{ +struct non_moveable +{ + non_moveable () = default; + non_moveable (non_moveable const &) = delete; + non_moveable (non_moveable &&) = delete; + non_moveable & operator= (non_moveable const &) = delete; + non_moveable & operator= (non_moveable &&) = delete; - no_copyable nc; + friend std::ostream & operator<< (std::ostream & os, non_moveable const & nm) + { + os << "non_moveable"; + return os; + } +}; +} + +TEST (trace_logging, no_move) +{ + non_moveable nm; nano::logger logger; - logger.trace (nano::log::type::all, nano::log::detail::all, nano::log::arg{ "no_copyable", nc }); + logger.trace (nano::log::type::all, nano::log::detail::all, nano::log::arg{ "non_moveable", nm }); } \ No newline at end of file