diff options
author | Andres Noetzli <andres.noetzli@gmail.com> | 2018-10-02 10:28:38 -0700 |
---|---|---|
committer | Aina Niemetz <aina.niemetz@gmail.com> | 2018-10-02 10:28:38 -0700 |
commit | 8519233cec9501f31aa1789eff60cb802c8df450 (patch) | |
tree | 60c87d9fe4c59ac565b3fdd66710229f58bc6a44 /test/unit/context/cdmap_black.h | |
parent | 64a0e3f1e4a5a8e3070eeadae0f6942b290c2974 (diff) |
Fix "catching polymorphic type by value" warnings (#2556)
When using the `TS_ASSERT_THROWS` marco from CxxTest, we have to make
sure that we use a reference type for the exception, otherwise the unit
test tries to catch the exception by value, resulting in "catching
polymorphic type by value" warnings.
Diffstat (limited to 'test/unit/context/cdmap_black.h')
-rw-r--r-- | test/unit/context/cdmap_black.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/test/unit/context/cdmap_black.h b/test/unit/context/cdmap_black.h index 2d2b3f409..1cb7e50e7 100644 --- a/test/unit/context/cdmap_black.h +++ b/test/unit/context/cdmap_black.h @@ -164,9 +164,9 @@ class CDMapBlack : public CxxTest::TestSuite { ElementsAre(map, {{1, 2}, {3, 4}, {5, 6}, {9, 8}, {23, 317}})); TS_ASSERT_THROWS(map.insertAtContextLevelZero(23, 317), - AssertionException); + AssertionException&); TS_ASSERT_THROWS(map.insertAtContextLevelZero(23, 472), - AssertionException); + AssertionException&); map.insert(23, 472); TS_ASSERT( @@ -178,7 +178,7 @@ class CDMapBlack : public CxxTest::TestSuite { ElementsAre(map, {{1, 2}, {3, 4}, {5, 6}, {9, 8}, {23, 472}})); TS_ASSERT_THROWS(map.insertAtContextLevelZero(23, 0), - AssertionException); + AssertionException&); map.insert(23, 1024); TS_ASSERT( @@ -194,7 +194,8 @@ class CDMapBlack : public CxxTest::TestSuite { TS_ASSERT( ElementsAre(map, {{3, 4}, {5, 6}, {9, 8}, {23, 317}})); - TS_ASSERT_THROWS(map.insertAtContextLevelZero(23, 0), AssertionException); + TS_ASSERT_THROWS(map.insertAtContextLevelZero(23, 0), + AssertionException&); map.insert(23, 477); TS_ASSERT( @@ -202,7 +203,7 @@ class CDMapBlack : public CxxTest::TestSuite { d_context->pop(); } - TS_ASSERT_THROWS(map.insertAtContextLevelZero(23, 0), AssertionException); + TS_ASSERT_THROWS(map.insertAtContextLevelZero(23, 0), AssertionException&); TS_ASSERT( ElementsAre(map, {{3, 4}, {23, 317}})); |