Skip to content

Commit

Permalink
#2954: Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Dani-Hub committed Jul 2, 2022
1 parent 9c53225 commit abbda20
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ add_fmt_test(printf-test)
add_fmt_test(ranges-test ranges-odr-test.cc)
add_fmt_test(scan-test)
add_fmt_test(std-test)
add_fmt_test(ranges-std-test)
add_fmt_test(unicode-test HEADER_ONLY)
if (MSVC)
target_compile_options(unicode-test PRIVATE /utf-8)
Expand Down
26 changes: 26 additions & 0 deletions test/ranges-std-test.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Formatting library for C++ - tests for ranges and std combination
//
// Copyright (c) 2012 - present, Victor Zverovich
// All rights reserved.
//
// For the license information refer to format.h.
//
// Copyright (c) 2022 - present, Dani-Hub (Daniel Kruegler)
// All rights reserved

#include "fmt/ranges.h"
#include "fmt/std.h"

#include <string>
#include <vector>

#include "gtest/gtest.h"

TEST(ranges_std_test, format_vector_path) {
#ifdef __cpp_lib_filesystem
auto p = std::filesystem::path("foo/bar.txt");
auto c = std::vector<std::string>{"abc", "def"};
EXPECT_EQ(fmt::format("path={}, range={}", p, c),
"path=\"foo/bar.txt\", range=[\"abc\", \"def\"]");
#endif
}

0 comments on commit abbda20

Please sign in to comment.