From c439ebc9fa28d380205c1636494ec0309f242d1a Mon Sep 17 00:00:00 2001 From: Martin Hierholzer <martin.hierholzer@desy.de> Date: Thu, 5 Jul 2018 10:18:02 +0200 Subject: [PATCH] catch polymorphic exceptions always by reference --- tests/executables_src/testApplication.cc | 8 ++++---- tests/executables_src/testTestFacilities.cc | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/executables_src/testApplication.cc b/tests/executables_src/testApplication.cc index 28726af3..8ddd73d8 100644 --- a/tests/executables_src/testApplication.cc +++ b/tests/executables_src/testApplication.cc @@ -59,7 +59,7 @@ BOOST_AUTO_TEST_CASE( testApplicationExceptions ) { TestApp app(""); BOOST_FAIL("Exception expected."); } - catch(ctk::ApplicationExceptionWithID<ctk::ApplicationExceptionID::illegalParameter>) { + catch(ctk::ApplicationExceptionWithID<ctk::ApplicationExceptionID::illegalParameter>&) { } // names with spaces and special characters are forbidden @@ -67,13 +67,13 @@ BOOST_AUTO_TEST_CASE( testApplicationExceptions ) { TestApp app("With space"); BOOST_FAIL("Exception expected."); } - catch(ctk::ApplicationExceptionWithID<ctk::ApplicationExceptionID::illegalParameter>) { + catch(ctk::ApplicationExceptionWithID<ctk::ApplicationExceptionID::illegalParameter>&) { } try { TestApp app("WithExclamationMark!"); BOOST_FAIL("Exception expected."); } - catch(ctk::ApplicationExceptionWithID<ctk::ApplicationExceptionID::illegalParameter>) { + catch(ctk::ApplicationExceptionWithID<ctk::ApplicationExceptionID::illegalParameter>&) { } // all allowed characters in the name @@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE( testApplicationExceptions ) { TestApp app2("SecondInstance"); BOOST_FAIL("Exception expected."); } - catch(std::runtime_error) { + catch(std::runtime_error&) { } } diff --git a/tests/executables_src/testTestFacilities.cc b/tests/executables_src/testTestFacilities.cc index acba07fa..2d5fada5 100644 --- a/tests/executables_src/testTestFacilities.cc +++ b/tests/executables_src/testTestFacilities.cc @@ -440,7 +440,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testReadAny, T, test_types ) { test.stepApplication(); BOOST_ERROR("IllegalParameter exception expected."); } - catch(ctk::ApplicationExceptionWithID<ctk::ApplicationExceptionID::illegalParameter>) { + catch(ctk::ApplicationExceptionWithID<ctk::ApplicationExceptionID::illegalParameter>&) { } // check that we still don't receive anything anymore @@ -549,7 +549,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testChainedModules, T, test_types ) { test.stepApplication(); BOOST_ERROR("IllegalParameter exception expected."); } - catch(ctk::ApplicationExceptionWithID<ctk::ApplicationExceptionID::illegalParameter>) { + catch(ctk::ApplicationExceptionWithID<ctk::ApplicationExceptionID::illegalParameter>&) { } // check that we still don't receive anything anymore @@ -653,7 +653,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testWithFanOut, T, test_types ) { test.stepApplication(); BOOST_ERROR("IllegalParameter exception expected."); } - catch(ctk::ApplicationExceptionWithID<ctk::ApplicationExceptionID::illegalParameter>) { + catch(ctk::ApplicationExceptionWithID<ctk::ApplicationExceptionID::illegalParameter>&) { } // check that we still don't receive anything anymore @@ -744,7 +744,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testWithTrigger, T, test_types ) { test.stepApplication(); BOOST_ERROR("IllegalParameter exception expected."); } - catch(ctk::ApplicationExceptionWithID<ctk::ApplicationExceptionID::illegalParameter>) { + catch(ctk::ApplicationExceptionWithID<ctk::ApplicationExceptionID::illegalParameter>&) { } // check that we still don't receive anything anymore @@ -862,7 +862,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testWithTriggerFanOut, T, test_types ) { test.stepApplication(); BOOST_ERROR("IllegalParameter exception expected."); } - catch(ctk::ApplicationExceptionWithID<ctk::ApplicationExceptionID::illegalParameter>) { + catch(ctk::ApplicationExceptionWithID<ctk::ApplicationExceptionID::illegalParameter>&) { } // check that we still don't receive anything anymore -- GitLab