TST: Do not catch exceptions by value

This commit is contained in:
Nikita Kniazev
2018-10-19 01:46:27 +03:00
committed by James E. King III
parent 86f05aa602
commit df1f33eb00
2 changed files with 5 additions and 5 deletions

View File

@ -631,7 +631,7 @@ test_ref()
boost::function2<int, int, int> f(ref(atc)); boost::function2<int, int, int> f(ref(atc));
BOOST_CHECK(f(1, 3) == 4); BOOST_CHECK(f(1, 3) == 4);
} }
catch(std::runtime_error e) { catch(std::runtime_error const&) {
BOOST_ERROR("Nonthrowing constructor threw an exception"); BOOST_ERROR("Nonthrowing constructor threw an exception");
} }
} }

View File

@ -624,7 +624,7 @@ test_ref()
boost::function<int (int, int)> f(boost::ref(atc)); boost::function<int (int, int)> f(boost::ref(atc));
BOOST_CHECK(f(1, 3) == 4); BOOST_CHECK(f(1, 3) == 4);
} }
catch(std::runtime_error e) { catch(std::runtime_error const&) {
BOOST_ERROR("Nonthrowing constructor threw an exception"); BOOST_ERROR("Nonthrowing constructor threw an exception");
} }
} }
@ -651,14 +651,14 @@ static void test_empty_ref()
f2(); f2();
BOOST_ERROR("Exception didn't throw for reference to empty function."); BOOST_ERROR("Exception didn't throw for reference to empty function.");
} }
catch(std::runtime_error e) {} catch(std::runtime_error const&) {}
f1 = dummy; f1 = dummy;
try { try {
f2(); f2();
} }
catch(std::runtime_error e) { catch(std::runtime_error const&) {
BOOST_ERROR("Error calling referenced function."); BOOST_ERROR("Error calling referenced function.");
} }
} }
@ -673,7 +673,7 @@ static void test_exception()
f(5, 4); f(5, 4);
BOOST_CHECK(false); BOOST_CHECK(false);
} }
catch(boost::bad_function_call) { catch(boost::bad_function_call const&) {
// okay // okay
} }
} }