1 // Copyright 2020 Peter Dimov 2 // Distributed under the Boost Software License, Version 1.0. 3 // http://www.boost.org/LICENSE_1_0.txt 4 5 #include <boost/assert/source_location.hpp> 6 #include <boost/core/lightweight_test.hpp> 7 #include <sstream> 8 main()9int main() 10 { 11 { 12 boost::source_location loc; 13 14 std::ostringstream os; 15 os << loc; 16 17 BOOST_TEST_EQ( os.str(), std::string( "(unknown source location)" ) ); 18 } 19 20 { 21 boost::source_location loc = BOOST_CURRENT_LOCATION; 22 23 std::ostringstream os; 24 os << loc; 25 26 BOOST_TEST_EQ( os.str(), std::string( __FILE__ ) + ":21: in function '" + BOOST_CURRENT_FUNCTION + "'" ); 27 } 28 29 return boost::report_errors(); 30 } 31