1//     __ _____ _____ _____
2//  __|  |   __|     |   | |  JSON for Modern C++ (supporting code)
3// |  |  |__   |  |  | | | |  version 3.11.2
4// |_____|_____|_____|_|___|  https://github.com/nlohmann/json
5//
6// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me>
7// SPDX-License-Identifier: MIT
8
9#include "doctest_compatibility.h"
10
11#include <nlohmann/json.hpp>
12
13TEST_CASE("use current library with inline namespace")
14{
15    SECTION("implicitly")
16    {
17        using nlohmann::json;
18        using nlohmann::ordered_json;
19
20        json j;
21        // In v3.10.5 mixing json_pointers of different basic_json types
22        // results in implicit string conversion
23        j[ordered_json::json_pointer("/root")] = json::object();
24        CHECK(j.dump() == "{\"root\":{}}");
25    }
26
27    SECTION("explicitly")
28    {
29        using NLOHMANN_JSON_NAMESPACE::json;
30        using NLOHMANN_JSON_NAMESPACE::ordered_json;
31
32        json j;
33        j[ordered_json::json_pointer("/root")] = json::object();
34        CHECK(j.dump() == "{\"root\":{}}");
35    }
36}
37