@@ -326,6 +326,7 @@ TEST_CASE("test suite from json-test-suite")
326
326
TEST_CASE (" json.org examples" )
327
327
{
328
328
// here, we list all JSON values from https://json.org/example
329
+ using FilePtr = std::unique_ptr<FILE, int (*)(FILE*)>;
329
330
330
331
SECTION (" 1.json" )
331
332
{
@@ -363,35 +364,35 @@ TEST_CASE("json.org examples")
363
364
}
364
365
SECTION (" FILE 1.json" )
365
366
{
366
- const std::unique_ptr<std::FILE, decltype (&std::fclose)> f (std::fopen (TEST_DATA_DIRECTORY " /json.org/1.json" , " r" ), &std::fclose);
367
+ const FilePtr f (std::fopen (TEST_DATA_DIRECTORY " /json.org/1.json" , " r" ), &std::fclose);
367
368
json _;
368
369
CHECK_NOTHROW (_ = json::parse (f.get ()));
369
370
}
370
371
371
372
SECTION (" FILE 2.json" )
372
373
{
373
- const std::unique_ptr<std::FILE, decltype (&std::fclose)> f (std::fopen (TEST_DATA_DIRECTORY " /json.org/2.json" , " r" ), &std::fclose);
374
+ const FilePtr f (std::fopen (TEST_DATA_DIRECTORY " /json.org/2.json" , " r" ), &std::fclose);
374
375
json _;
375
376
CHECK_NOTHROW (_ = json::parse (f.get ()));
376
377
}
377
378
378
379
SECTION (" FILE 3.json" )
379
380
{
380
- const std::unique_ptr<std::FILE, decltype (&std::fclose)> f (std::fopen (TEST_DATA_DIRECTORY " /json.org/3.json" , " r" ), &std::fclose);
381
+ const FilePtr f (std::fopen (TEST_DATA_DIRECTORY " /json.org/3.json" , " r" ), &std::fclose);
381
382
json _;
382
383
CHECK_NOTHROW (_ = json::parse (f.get ()));
383
384
}
384
385
385
386
SECTION (" FILE 4.json" )
386
387
{
387
- const std::unique_ptr<std::FILE, decltype (&std::fclose)> f (std::fopen (TEST_DATA_DIRECTORY " /json.org/4.json" , " r" ), &std::fclose);
388
+ const FilePtr f (std::fopen (TEST_DATA_DIRECTORY " /json.org/4.json" , " r" ), &std::fclose);
388
389
json _;
389
390
CHECK_NOTHROW (_ = json::parse (f.get ()));
390
391
}
391
392
392
393
SECTION (" FILE 5.json" )
393
394
{
394
- const std::unique_ptr<std::FILE, decltype (&std::fclose)> f (std::fopen (TEST_DATA_DIRECTORY " /json.org/5.json" , " r" ), &std::fclose);
395
+ const FilePtr f (std::fopen (TEST_DATA_DIRECTORY " /json.org/5.json" , " r" ), &std::fclose);
395
396
json _;
396
397
CHECK_NOTHROW (_ = json::parse (f.get ()));
397
398
}
0 commit comments