Skip to content

Commit

Permalink
Replace direct initialization from json with explicit calls to json::…
Browse files Browse the repository at this point in the history
…get<...>
  • Loading branch information
karzhenkov committed Jan 2, 2021
1 parent 381bbe3 commit 76a83a9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/src/unit-conversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1712,7 +1712,7 @@ TEST_CASE("std::optional")
std::optional<std::string> opt_null;

CHECK(json(opt_null) == j_null);
CHECK(std::optional<std::string>(j_null) == std::nullopt);
CHECK(j_null.get<std::optional<std::string>>() == std::nullopt);
}

SECTION("string")
Expand Down Expand Up @@ -1748,7 +1748,7 @@ TEST_CASE("std::optional")
std::vector<std::optional<int>> opt_array = {{1, 2, std::nullopt}};

CHECK(json(opt_array) == j_array);
CHECK(std::vector<std::optional<int>>(j_array) == opt_array);
CHECK(j_array.get<std::vector<std::optional<int>>>() == opt_array);
}

SECTION("object")
Expand All @@ -1757,7 +1757,7 @@ TEST_CASE("std::optional")
std::map<std::string, std::optional<int>> opt_object {{"one", 1}, {"two", 2}, {"zero", std::nullopt}};

CHECK(json(opt_object) == j_object);
CHECK(std::map<std::string, std::optional<int>>(j_object) == opt_object);
CHECK(j_object.get<std::map<std::string, std::optional<int>>>() == opt_object);
}
}
#endif
Expand Down

0 comments on commit 76a83a9

Please sign in to comment.