diff --git a/tests/src/unit-udt.cpp b/tests/src/unit-udt.cpp index 11d4940f4..f5d0ffc1e 100644 --- a/tests/src/unit-udt.cpp +++ b/tests/src/unit-udt.cpp @@ -23,6 +23,7 @@ using nlohmann::json; using namespace nlohmann::literals; // NOLINT(google-build-using-namespace) #endif +#include #include #include #include @@ -733,6 +734,68 @@ TEST_CASE("custom serializer that does adl by default" * doctest::test_suite("ud CHECK(me == cj.get()); } +TEST_CASE("with_*_t aliases" * doctest::test_suite("udt")) +{ + // a custom base class used to check with_base_class_t + struct custom_base_class {}; + + CHECK(std::is_same, + nlohmann::basic_json>>::value); + + CHECK(std::is_same, + nlohmann::basic_json>>::value); + + CHECK(std::is_same, + nlohmann::basic_json>>::value); + + CHECK(std::is_same, + nlohmann::basic_json>>::value); + + CHECK(std::is_same, + nlohmann::basic_json>>::value); + + CHECK(std::is_same, + nlohmann::basic_json>>::value); + + CHECK(std::is_same, + nlohmann::basic_json>>::value); + + CHECK(std::is_same, + nlohmann::basic_json>>::value); + + CHECK(std::is_same>, + nlohmann::basic_json>>::value); + + CHECK(std::is_same, + nlohmann::basic_json, custom_base_class>>::value); + + // with_string_t on ordered_json must keep ordered_map as the object type + CHECK(std::is_same, + nlohmann::basic_json>>::value); +} + TEST_CASE("different basic_json types conversions") { SECTION("null")