From 84d9706182fd1ba05d3791f1a884ee58e76451e8 Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Thu, 26 Jan 2012 17:47:56 +0000 Subject: [PATCH] Update tests with example from #6452 [SVN r76707] --- test/lexical_cast_empty_input_test.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/lexical_cast_empty_input_test.cpp b/test/lexical_cast_empty_input_test.cpp index 5a5881b..3b94f5f 100755 --- a/test/lexical_cast_empty_input_test.cpp +++ b/test/lexical_cast_empty_input_test.cpp @@ -138,6 +138,20 @@ void test_empty_vector() BOOST_CHECK_THROW(lexical_cast(v), bad_lexical_cast); } + +struct my_string { + friend std::ostream &operator<<(std::ostream& sout, my_string const&/* st*/) { + return sout << ""; + } +}; + +void test_empty_zero_terminated_string() +{ + my_string st; + std::string st2 = boost::lexical_cast(st); + (void)st2; +} + unit_test::test_suite *init_unit_test_suite(int, char *[]) { unit_test::test_suite *suite = @@ -146,6 +160,7 @@ unit_test::test_suite *init_unit_test_suite(int, char *[]) suite->add(BOOST_TEST_CASE(&test_empty_string)); suite->add(BOOST_TEST_CASE(&test_empty_user_class)); suite->add(BOOST_TEST_CASE(&test_empty_vector)); + suite->add(BOOST_TEST_CASE(&test_empty_zero_terminated_string)); return suite; }