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 "config.hpp"
12 
13 #define NLOHMANN_JSON_NAMESPACE_NO_VERSION 1
14 #include <nlohmann/json_fwd.hpp>
15 
16 TEST_CASE("default namespace without version component")
17 {
18     // GCC 4.8 fails with regex_error
19 #if !DOCTEST_GCC || DOCTEST_GCC >= DOCTEST_COMPILER(4, 9, 0)
20     SECTION("namespace matches expectation")
21     {
22         std::string expected = "nlohmann::json_abi";
23 
24 #if JSON_DIAGNOSTICS
25         expected += "_diag";
26 #endif
27 
28 #if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON
29         expected += "_ldvcmp";
30 #endif
31 
32         expected += "::basic_json";
33 
34         // fallback for Clang
35         std::string ns{STRINGIZE(NLOHMANN_JSON_NAMESPACE) "::basic_json"};
36 
37         CHECK(namespace_name<nlohmann::json>(ns) == expected);
38     }
39 #endif
40 }
41