Skip to content

Commit 9a70c60

Browse files
committed
Revert ":arrow_up: updated to Catch 2.0.1"
This reverts commit 920f64c.
1 parent fb8482d commit 9a70c60

23 files changed

Lines changed: 9767 additions & 10165 deletions

test/src/unit-algorithms.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ TEST_CASE("algorithms")
240240
SECTION("sorting an object")
241241
{
242242
json j({{"one", 1}, {"two", 2}});
243-
CHECK_THROWS_AS(std::sort(j.begin(), j.end()), json::invalid_iterator);
243+
CHECK_THROWS_AS(std::sort(j.begin(), j.end()), json::invalid_iterator&);
244244
CHECK_THROWS_WITH(std::sort(j.begin(), j.end()),
245245
"[json.exception.invalid_iterator.209] cannot use offsets with object iterators");
246246
}

test/src/unit-allocator.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ TEST_CASE("bad_alloc")
5959
bad_allocator>;
6060

6161
// creating an object should throw
62-
CHECK_THROWS_AS(bad_json(bad_json::value_t::object), std::bad_alloc);
62+
CHECK_THROWS_AS(bad_json(bad_json::value_t::object), std::bad_alloc&);
6363
}
6464
}
6565

@@ -143,7 +143,7 @@ TEST_CASE("controlled bad_alloc")
143143
auto t = my_json::value_t::object;
144144
CHECK_NOTHROW(my_allocator_clean_up(my_json::json_value(t).object));
145145
next_construct_fails = true;
146-
CHECK_THROWS_AS(my_json::json_value(t), std::bad_alloc);
146+
CHECK_THROWS_AS(my_json::json_value(t), std::bad_alloc&);
147147
next_construct_fails = false;
148148
}
149149
SECTION("array")
@@ -152,7 +152,7 @@ TEST_CASE("controlled bad_alloc")
152152
auto t = my_json::value_t::array;
153153
CHECK_NOTHROW(my_allocator_clean_up(my_json::json_value(t).array));
154154
next_construct_fails = true;
155-
CHECK_THROWS_AS(my_json::json_value(t), std::bad_alloc);
155+
CHECK_THROWS_AS(my_json::json_value(t), std::bad_alloc&);
156156
next_construct_fails = false;
157157
}
158158
SECTION("string")
@@ -161,7 +161,7 @@ TEST_CASE("controlled bad_alloc")
161161
auto t = my_json::value_t::string;
162162
CHECK_NOTHROW(my_allocator_clean_up(my_json::json_value(t).string));
163163
next_construct_fails = true;
164-
CHECK_THROWS_AS(my_json::json_value(t), std::bad_alloc);
164+
CHECK_THROWS_AS(my_json::json_value(t), std::bad_alloc&);
165165
next_construct_fails = false;
166166
}
167167
}
@@ -172,7 +172,7 @@ TEST_CASE("controlled bad_alloc")
172172
my_json::string_t v("foo");
173173
CHECK_NOTHROW(my_allocator_clean_up(my_json::json_value(v).string));
174174
next_construct_fails = true;
175-
CHECK_THROWS_AS(my_json::json_value(v), std::bad_alloc);
175+
CHECK_THROWS_AS(my_json::json_value(v), std::bad_alloc&);
176176
next_construct_fails = false;
177177
}
178178

@@ -183,7 +183,7 @@ TEST_CASE("controlled bad_alloc")
183183
my_json::object_t v {{"foo", "bar"}};
184184
CHECK_NOTHROW(my_json::json_value j(v));
185185
next_construct_fails = true;
186-
CHECK_THROWS_AS(my_json::json_value j(v), std::bad_alloc);
186+
CHECK_THROWS_AS(my_json::json_value j(v), std::bad_alloc&);
187187
next_construct_fails = false;
188188
}
189189
*/
@@ -194,7 +194,7 @@ TEST_CASE("controlled bad_alloc")
194194
my_json::array_t v = {"foo", "bar", "baz"};
195195
CHECK_NOTHROW(my_json::json_value j(v));
196196
next_construct_fails = true;
197-
CHECK_THROWS_AS(my_json::json_value j(v), std::bad_alloc);
197+
CHECK_THROWS_AS(my_json::json_value j(v), std::bad_alloc&);
198198
next_construct_fails = false;
199199
}
200200
*/
@@ -208,7 +208,7 @@ TEST_CASE("controlled bad_alloc")
208208
std::map<std::string, std::string> v {{"foo", "bar"}};
209209
CHECK_NOTHROW(my_json(v));
210210
next_construct_fails = true;
211-
CHECK_THROWS_AS(my_json(v), std::bad_alloc);
211+
CHECK_THROWS_AS(my_json(v), std::bad_alloc&);
212212
next_construct_fails = false;
213213
}
214214

@@ -218,7 +218,7 @@ TEST_CASE("controlled bad_alloc")
218218
std::vector<std::string> v {"foo", "bar", "baz"};
219219
CHECK_NOTHROW(my_json(v));
220220
next_construct_fails = true;
221-
CHECK_THROWS_AS(my_json(v), std::bad_alloc);
221+
CHECK_THROWS_AS(my_json(v), std::bad_alloc&);
222222
next_construct_fails = false;
223223
}
224224

@@ -227,7 +227,7 @@ TEST_CASE("controlled bad_alloc")
227227
next_construct_fails = false;
228228
CHECK_NOTHROW(my_json("foo"));
229229
next_construct_fails = true;
230-
CHECK_THROWS_AS(my_json("foo"), std::bad_alloc);
230+
CHECK_THROWS_AS(my_json("foo"), std::bad_alloc&);
231231
next_construct_fails = false;
232232
}
233233

@@ -237,7 +237,7 @@ TEST_CASE("controlled bad_alloc")
237237
std::string s("foo");
238238
CHECK_NOTHROW(my_json(s));
239239
next_construct_fails = true;
240-
CHECK_THROWS_AS(my_json(s), std::bad_alloc);
240+
CHECK_THROWS_AS(my_json(s), std::bad_alloc&);
241241
next_construct_fails = false;
242242
}
243243
}

test/src/unit-cbor.cpp

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ SOFTWARE.
3131
#include "json.hpp"
3232
using nlohmann::json;
3333

34-
#include <set>
3534
#include <fstream>
3635

3736
TEST_CASE("CBOR")
@@ -740,13 +739,13 @@ TEST_CASE("CBOR")
740739
{
741740
SECTION("no byte follows")
742741
{
743-
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0xf9})), json::parse_error);
742+
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0xf9})), json::parse_error&);
744743
CHECK_THROWS_WITH(json::from_cbor(std::vector<uint8_t>({0xf9})),
745744
"[json.exception.parse_error.110] parse error at 2: unexpected end of input");
746745
}
747746
SECTION("only one byte follows")
748747
{
749-
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0xf9, 0x7c})), json::parse_error);
748+
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0xf9, 0x7c})), json::parse_error&);
750749
CHECK_THROWS_WITH(json::from_cbor(std::vector<uint8_t>({0xf9, 0x7c})),
751750
"[json.exception.parse_error.110] parse error at 3: unexpected end of input");
752751
}
@@ -1227,28 +1226,28 @@ TEST_CASE("CBOR")
12271226
{
12281227
SECTION("empty byte vector")
12291228
{
1230-
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>()), json::parse_error);
1229+
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>()), json::parse_error&);
12311230
CHECK_THROWS_WITH(json::from_cbor(std::vector<uint8_t>()),
12321231
"[json.exception.parse_error.110] parse error at 1: unexpected end of input");
12331232
}
12341233

12351234
SECTION("too short byte vector")
12361235
{
1237-
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x18})), json::parse_error);
1238-
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x19})), json::parse_error);
1239-
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x19, 0x00})), json::parse_error);
1240-
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1a})), json::parse_error);
1241-
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1a, 0x00})), json::parse_error);
1242-
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1a, 0x00, 0x00})), json::parse_error);
1243-
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1a, 0x00, 0x00, 0x00})), json::parse_error);
1244-
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1b})), json::parse_error);
1245-
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00})), json::parse_error);
1246-
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00})), json::parse_error);
1247-
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00})), json::parse_error);
1248-
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00, 0x00})), json::parse_error);
1249-
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00, 0x00, 0x00})), json::parse_error);
1250-
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})), json::parse_error);
1251-
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})), json::parse_error);
1236+
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x18})), json::parse_error&);
1237+
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x19})), json::parse_error&);
1238+
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x19, 0x00})), json::parse_error&);
1239+
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1a})), json::parse_error&);
1240+
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1a, 0x00})), json::parse_error&);
1241+
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1a, 0x00, 0x00})), json::parse_error&);
1242+
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1a, 0x00, 0x00, 0x00})), json::parse_error&);
1243+
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1b})), json::parse_error&);
1244+
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00})), json::parse_error&);
1245+
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00})), json::parse_error&);
1246+
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00})), json::parse_error&);
1247+
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00, 0x00})), json::parse_error&);
1248+
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00, 0x00, 0x00})), json::parse_error&);
1249+
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})), json::parse_error&);
1250+
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})), json::parse_error&);
12521251

12531252
CHECK_THROWS_WITH(json::from_cbor(std::vector<uint8_t>({0x18})),
12541253
"[json.exception.parse_error.110] parse error at 2: unexpected end of input");
@@ -1286,10 +1285,10 @@ TEST_CASE("CBOR")
12861285
{
12871286
SECTION("concrete examples")
12881287
{
1289-
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1c})), json::parse_error);
1288+
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1c})), json::parse_error&);
12901289
CHECK_THROWS_WITH(json::from_cbor(std::vector<uint8_t>({0x1c})),
12911290
"[json.exception.parse_error.112] parse error at 1: error reading CBOR; last byte: 0x1C");
1292-
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0xf8})), json::parse_error);
1291+
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0xf8})), json::parse_error&);
12931292
CHECK_THROWS_WITH(json::from_cbor(std::vector<uint8_t>({0xf8})),
12941293
"[json.exception.parse_error.112] parse error at 1: error reading CBOR; last byte: 0xF8");
12951294
}
@@ -1340,14 +1339,14 @@ TEST_CASE("CBOR")
13401339
0xf8
13411340
})
13421341
{
1343-
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({static_cast<uint8_t>(byte)})), json::parse_error);
1342+
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({static_cast<uint8_t>(byte)})), json::parse_error&);
13441343
}
13451344
}
13461345
}
13471346

13481347
SECTION("invalid string in map")
13491348
{
1350-
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0xa1, 0xff, 0x01})), json::parse_error);
1349+
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0xa1, 0xff, 0x01})), json::parse_error&);
13511350
CHECK_THROWS_WITH(json::from_cbor(std::vector<uint8_t>({0xa1, 0xff, 0x01})),
13521351
"[json.exception.parse_error.113] parse error at 2: expected a CBOR string; last byte: 0xFF");
13531352
}
@@ -1363,7 +1362,7 @@ TEST_CASE("CBOR")
13631362

13641363
SECTION("strict mode")
13651364
{
1366-
CHECK_THROWS_AS(json::from_cbor(vec), json::parse_error);
1365+
CHECK_THROWS_AS(json::from_cbor(vec), json::parse_error&);
13671366
CHECK_THROWS_WITH(json::from_cbor(vec),
13681367
"[json.exception.parse_error.110] parse error at 2: expected end of input");
13691368
}

test/src/unit-class_const_iterator.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ TEST_CASE("const_iterator class")
147147
{
148148
json j(json::value_t::null);
149149
json::const_iterator it = j.cbegin();
150-
CHECK_THROWS_AS(*it, json::invalid_iterator);
150+
CHECK_THROWS_AS(*it, json::invalid_iterator&);
151151
CHECK_THROWS_WITH(*it, "[json.exception.invalid_iterator.214] cannot get value");
152152
}
153153

@@ -157,7 +157,7 @@ TEST_CASE("const_iterator class")
157157
json::const_iterator it = j.cbegin();
158158
CHECK(*it == json(17));
159159
it = j.cend();
160-
CHECK_THROWS_AS(*it, json::invalid_iterator);
160+
CHECK_THROWS_AS(*it, json::invalid_iterator&);
161161
CHECK_THROWS_WITH(*it, "[json.exception.invalid_iterator.214] cannot get value");
162162
}
163163

@@ -182,7 +182,7 @@ TEST_CASE("const_iterator class")
182182
{
183183
json j(json::value_t::null);
184184
json::const_iterator it = j.cbegin();
185-
CHECK_THROWS_AS(std::string(it->type_name()), json::invalid_iterator);
185+
CHECK_THROWS_AS(std::string(it->type_name()), json::invalid_iterator&);
186186
CHECK_THROWS_WITH(std::string(it->type_name()), "[json.exception.invalid_iterator.214] cannot get value");
187187
}
188188

@@ -192,7 +192,7 @@ TEST_CASE("const_iterator class")
192192
json::const_iterator it = j.cbegin();
193193
CHECK(std::string(it->type_name()) == "number");
194194
it = j.cend();
195-
CHECK_THROWS_AS(std::string(it->type_name()), json::invalid_iterator);
195+
CHECK_THROWS_AS(std::string(it->type_name()), json::invalid_iterator&);
196196
CHECK_THROWS_WITH(std::string(it->type_name()), "[json.exception.invalid_iterator.214] cannot get value");
197197
}
198198

test/src/unit-class_iterator.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ TEST_CASE("iterator class")
131131
{
132132
json j(json::value_t::null);
133133
json::iterator it = j.begin();
134-
CHECK_THROWS_AS(*it, json::invalid_iterator);
134+
CHECK_THROWS_AS(*it, json::invalid_iterator&);
135135
CHECK_THROWS_WITH(*it, "[json.exception.invalid_iterator.214] cannot get value");
136136
}
137137

@@ -141,7 +141,7 @@ TEST_CASE("iterator class")
141141
json::iterator it = j.begin();
142142
CHECK(*it == json(17));
143143
it = j.end();
144-
CHECK_THROWS_AS(*it, json::invalid_iterator);
144+
CHECK_THROWS_AS(*it, json::invalid_iterator&);
145145
CHECK_THROWS_WITH(*it, "[json.exception.invalid_iterator.214] cannot get value");
146146
}
147147

@@ -166,7 +166,7 @@ TEST_CASE("iterator class")
166166
{
167167
json j(json::value_t::null);
168168
json::iterator it = j.begin();
169-
CHECK_THROWS_AS(std::string(it->type_name()), json::invalid_iterator);
169+
CHECK_THROWS_AS(std::string(it->type_name()), json::invalid_iterator&);
170170
CHECK_THROWS_WITH(std::string(it->type_name()), "[json.exception.invalid_iterator.214] cannot get value");
171171
}
172172

@@ -176,7 +176,7 @@ TEST_CASE("iterator class")
176176
json::iterator it = j.begin();
177177
CHECK(std::string(it->type_name()) == "number");
178178
it = j.end();
179-
CHECK_THROWS_AS(std::string(it->type_name()), json::invalid_iterator);
179+
CHECK_THROWS_AS(std::string(it->type_name()), json::invalid_iterator&);
180180
CHECK_THROWS_WITH(std::string(it->type_name()), "[json.exception.invalid_iterator.214] cannot get value");
181181
}
182182

0 commit comments

Comments
 (0)