Skip to content

Regression test for #3070 is not being run and fails when enabled #3377

Closed
@falbrechtskirchinger

Description

@falbrechtskirchinger

Working on some unit test improvements, I discovered at least two unit tests that are not being run. This issue is about

#if JSON_HAS_FILESYSTEM || JSON_HAS_EXPERIMENTAL_FILESYSTEM
    SECTION("issue #3070 - Version 3.10.3 breaks backward-compatibility with 3.10.2 ")
    {
        static_assert(false); // Added to confirm this test is never run
        nlohmann::detail::std_fs::path text_path("/tmp/text.txt");
        json j(text_path);

        const auto j_path = j.get<nlohmann::detail::std_fs::path>();
        CHECK(j_path == text_path);

        CHECK_THROWS_WITH_AS(nlohmann::detail::std_fs::path(json(1)), "[json.exception.type_error.302] type must be string, but is number", json::type_error);
    }
#endif

added in 6d31159.

nlohmann::detail::std_fs::path(json(1)) fails to compile, because the constructor call is ambiguous.

@theodelrieu @nlohmann Was/is this expected to work?

(The fact, that this test isn't being run will be fixed by an upcoming PR.)

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions