Skip to content

Commit

Permalink
✅ improved test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
nlohmann committed Sep 14, 2017
1 parent 737816d commit 647711f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/src/unit-json_pointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,4 +430,23 @@ TEST_CASE("JSON pointers")
CHECK(json::json_pointer(ptr).to_string() == ptr);
}
}

SECTION("conversion")
{
SECTION("array")
{
json j;
// all numbers -> array
j["/12"_json_pointer] = 0;
CHECK(j.is_array());
}

SECTION("object")
{
json j;
// contains a number, but is not a number -> object
j["/a12"_json_pointer] = 0;
CHECK(j.is_object());
}
}
}

0 comments on commit 647711f

Please sign in to comment.