From 57e6fddd90fd9293872a5e197a970809266139db Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Tue, 30 Jan 2018 23:57:49 +0100 Subject: [PATCH] :rotating_light: fixed warnings --- test/src/unit-constructor1.cpp | 6 +++--- test/src/unit-convenience.cpp | 4 ++-- test/src/unit-conversions.cpp | 2 +- test/src/unit-json_pointer.cpp | 2 +- test/src/unit-regression.cpp | 6 +++--- test/src/unit-ubjson.cpp | 12 ++++++------ 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/test/src/unit-constructor1.cpp b/test/src/unit-constructor1.cpp index 9d93f6f58..33a4f677f 100644 --- a/test/src/unit-constructor1.cpp +++ b/test/src/unit-constructor1.cpp @@ -295,11 +295,11 @@ TEST_CASE("constructors") { json j{1}; - CHECK_THROWS_AS((j.get>()), json::out_of_range); + CHECK_THROWS_AS((j.get>()), json::out_of_range&); CHECK_THROWS_WITH((j.get>()), "[json.exception.out_of_range.401] array index 1 is out of range"); - CHECK_THROWS_AS((j.get>()), json::out_of_range); + CHECK_THROWS_AS((j.get>()), json::out_of_range&); CHECK_THROWS_WITH((j.get>()), "[json.exception.out_of_range.401] array index 1 is out of range"); - CHECK_THROWS_AS((j.get>()), json::out_of_range); + CHECK_THROWS_AS((j.get>()), json::out_of_range&); CHECK_THROWS_WITH((j.get>()), "[json.exception.out_of_range.401] array index 1 is out of range"); } diff --git a/test/src/unit-convenience.cpp b/test/src/unit-convenience.cpp index 2bfef0fc1..f74c00aec 100644 --- a/test/src/unit-convenience.cpp +++ b/test/src/unit-convenience.cpp @@ -99,11 +99,11 @@ TEST_CASE("convenience functions") check_escaped("\x1f", "\\u001f"); // invalid UTF-8 characters - CHECK_THROWS_AS(check_escaped("ä\xA9ü"), json::type_error); + CHECK_THROWS_AS(check_escaped("ä\xA9ü"), json::type_error&); CHECK_THROWS_WITH(check_escaped("ä\xA9ü"), "[json.exception.type_error.316] invalid UTF-8 byte at index 2: 0xA9"); - CHECK_THROWS_AS(check_escaped("\xC2"), json::type_error); + CHECK_THROWS_AS(check_escaped("\xC2"), json::type_error&); CHECK_THROWS_WITH(check_escaped("\xC2"), "[json.exception.type_error.316] incomplete UTF-8 string; last byte: 0xC2"); } diff --git a/test/src/unit-conversions.cpp b/test/src/unit-conversions.cpp index fb0ab4eb4..f9d49a838 100644 --- a/test/src/unit-conversions.cpp +++ b/test/src/unit-conversions.cpp @@ -1020,7 +1020,7 @@ TEST_CASE("value conversion") SECTION("std::array is larger than JSON") { std::array arr6 = {{1, 2, 3, 4, 5, 6}}; - CHECK_THROWS_AS(arr6 = j1, json::out_of_range); + CHECK_THROWS_AS(arr6 = j1, json::out_of_range&); CHECK_THROWS_WITH(arr6 = j1, "[json.exception.out_of_range.401] array index 4 is out of range"); } diff --git a/test/src/unit-json_pointer.cpp b/test/src/unit-json_pointer.cpp index b6b83760a..7a4933475 100644 --- a/test/src/unit-json_pointer.cpp +++ b/test/src/unit-json_pointer.cpp @@ -60,7 +60,7 @@ TEST_CASE("JSON pointers") { json v = {1, 2, 3, 4}; json::json_pointer ptr("/10e"); - CHECK_THROWS_AS(v[ptr], json::out_of_range); + CHECK_THROWS_AS(v[ptr], json::out_of_range&); CHECK_THROWS_WITH(v[ptr], "[json.exception.out_of_range.404] unresolved reference token '10e'"); } diff --git a/test/src/unit-regression.cpp b/test/src/unit-regression.cpp index 886392b19..c4a04775d 100644 --- a/test/src/unit-regression.cpp +++ b/test/src/unit-regression.cpp @@ -1369,7 +1369,7 @@ TEST_CASE("regression tests") uint8_t key1[] = { 103, 92, 117, 48, 48, 48, 55, 92, 114, 215, 126, 214, 95, 92, 34, 174, 40, 71, 38, 174, 40, 71, 38, 223, 134, 247, 127 }; std::string key1_str(key1, key1 + sizeof(key1) / sizeof(key1[0])); json j = key1_str; - CHECK_THROWS_AS(j.dump(), json::type_error); + CHECK_THROWS_AS(j.dump(), json::type_error&); CHECK_THROWS_WITH(j.dump(), "[json.exception.type_error.316] invalid UTF-8 byte at index 10: 0x7E"); } @@ -1394,7 +1394,7 @@ TEST_CASE("regression tests") CHECK_THROWS_AS(model.patch(R"([{"op": "move", "from": "/one/two/three", - "path": "/a/b/c"}])"_json), json::out_of_range); + "path": "/a/b/c"}])"_json), json::out_of_range&); CHECK_THROWS_WITH(model.patch(R"([{"op": "move", "from": "/one/two/three", "path": "/a/b/c"}])"_json), @@ -1402,7 +1402,7 @@ TEST_CASE("regression tests") CHECK_THROWS_AS(model.patch(R"([{"op": "copy", "from": "/one/two/three", - "path": "/a/b/c"}])"_json), json::out_of_range); + "path": "/a/b/c"}])"_json), json::out_of_range&); CHECK_THROWS_WITH(model.patch(R"([{"op": "copy", "from": "/one/two/three", "path": "/a/b/c"}])"_json), diff --git a/test/src/unit-ubjson.cpp b/test/src/unit-ubjson.cpp index 2d87e5700..144fcfe1a 100644 --- a/test/src/unit-ubjson.cpp +++ b/test/src/unit-ubjson.cpp @@ -1186,7 +1186,7 @@ TEST_CASE("UBJSON") { // larger than max int64 json j = 9223372036854775808llu; - CHECK_THROWS_AS(json::to_ubjson(j), json::out_of_range); + CHECK_THROWS_AS(json::to_ubjson(j), json::out_of_range&); CHECK_THROWS_WITH(json::to_ubjson(j), "[json.exception.out_of_range.407] number overflow serializing 9223372036854775808"); } } @@ -1340,14 +1340,14 @@ TEST_CASE("UBJSON") SECTION("eof after C byte") { std::vector v = {'C'}; - CHECK_THROWS_AS(json::from_ubjson(v), json::parse_error); + CHECK_THROWS_AS(json::from_ubjson(v), json::parse_error&); CHECK_THROWS_WITH(json::from_ubjson(v), "[json.exception.parse_error.110] parse error at 2: unexpected end of input"); } SECTION("byte out of range") { std::vector v = {'C', 130}; - CHECK_THROWS_AS(json::from_ubjson(v), json::parse_error); + CHECK_THROWS_AS(json::from_ubjson(v), json::parse_error&); CHECK_THROWS_WITH(json::from_ubjson(v), "[json.exception.parse_error.113] parse error at 2: byte after 'C' must be in range 0x00..0x7F; last byte: 0x82"); } } @@ -1357,14 +1357,14 @@ TEST_CASE("UBJSON") SECTION("eof after S byte") { std::vector v = {'S'}; - CHECK_THROWS_AS(json::from_ubjson(v), json::parse_error); + CHECK_THROWS_AS(json::from_ubjson(v), json::parse_error&); CHECK_THROWS_WITH(json::from_ubjson(v), "[json.exception.parse_error.110] parse error at 2: unexpected end of input"); } SECTION("invalid byte") { std::vector v = {'S', '1', 'a'}; - CHECK_THROWS_AS(json::from_ubjson(v), json::parse_error); + CHECK_THROWS_AS(json::from_ubjson(v), json::parse_error&); CHECK_THROWS_WITH(json::from_ubjson(v), "[json.exception.parse_error.113] parse error at 2: expected a UBJSON string; last byte: 0x31"); } } @@ -1374,7 +1374,7 @@ TEST_CASE("UBJSON") SECTION("optimized array: no size following type") { std::vector v = {'[', '$', 'i', 2}; - CHECK_THROWS_AS(json::from_ubjson(v), json::parse_error); + CHECK_THROWS_AS(json::from_ubjson(v), json::parse_error&); CHECK_THROWS_WITH(json::from_ubjson(v), "[json.exception.parse_error.112] parse error at 4: expected '#' after UBJSON type information; last byte: 0x02"); } }