Skip to content

Commit bdc1e5e

Browse files
enable fmt_module tests by updating module-test.cc
- Update g++ module testing to use g++ version 15 instead of 14. The module support in version 14 isn't very stable and the module testing was not working due to unresolved locale symbols. - Refactor test/CMakeLists.txt to enable testing for modules - The tests in `module-test.cc` seem to not have been updated in some time despite changes in the main library. - Wide String versions of several tests appear to be deprecated so have been commented out. - Refactored tests related to `fmt::format_args` that now requires lvalue references as opposed to direct values. - MSVC has some bugs that are still present since the module-test.cc file was initially written. We update the version detection to current versions. - MSVC and the other compilers take different paths in determining the fmt::detail namespace. Used #ifdef macros to enforce this. This enables module testing to work on all compilers - clang-format base.h due to lint failure on CI
1 parent 3febdca commit bdc1e5e

File tree

4 files changed

+124
-70
lines changed

4 files changed

+124
-70
lines changed

.github/workflows/linux.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ jobs:
3737
std: 23
3838
install: sudo apt install g++-13
3939
shared: -DBUILD_SHARED_LIBS=ON
40-
- cxx: g++-14
40+
- cxx: g++-15
4141
build_type: Release
4242
std: 23
43-
install: sudo apt install g++-14
43+
install: sudo apt install g++-15
4444
gen: Ninja
4545
- cxx: clang++-3.6
4646
- cxx: clang++-11
@@ -147,7 +147,7 @@ jobs:
147147
- name: Add repositories for newer GCC
148148
run: |
149149
sudo apt-add-repository ppa:ubuntu-toolchain-r/test
150-
if: ${{ matrix.cxx == 'g++-13' || matrix.cxx == 'g++-14' }}
150+
if: ${{ matrix.cxx == 'g++-13' || matrix.cxx == 'g++-15' }}
151151

152152
- name: Install LLVM-20
153153
run: |

include/fmt/base.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1872,10 +1872,10 @@ template <typename OutputIt, typename T, typename = void>
18721872
struct has_insert : std::false_type {};
18731873

18741874
template <typename OutputIt, typename T>
1875-
struct has_insert<OutputIt, T,
1876-
void_t<decltype(get_container(std::declval<OutputIt>())
1877-
.insert({}, std::declval<T>(),
1878-
std::declval<T>()))>>
1875+
struct has_insert<
1876+
OutputIt, T,
1877+
void_t<decltype(get_container(std::declval<OutputIt>())
1878+
.insert({}, std::declval<T>(), std::declval<T>()))>>
18791879
: std::true_type {};
18801880

18811881
// An optimized version of std::copy with the output value type (T).

test/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function (add_fmt_test name)
1919
set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS} -Wno-weak-vtables)
2020
endif ()
2121
elseif (ADD_FMT_TEST_MODULE)
22-
set(libs test-main)
22+
set(libs test-main fmt-module)
2323
else ()
2424
set(libs test-main fmt)
2525
endif ()
@@ -81,9 +81,7 @@ add_executable(perf-sanity perf-sanity.cc)
8181
target_link_libraries(perf-sanity fmt::fmt)
8282

8383
if (FMT_MODULE)
84-
# Module tests are currently disabled.
85-
# add_fmt_test(module-test MODULE test-main.cc)
86-
# target_link_libraries(module-test fmt-module)
84+
add_fmt_test(module-test MODULE)
8785
endif ()
8886

8987
if (NOT DEFINED MSVC_STATIC_RUNTIME AND MSVC)

0 commit comments

Comments
 (0)