Skip to content

Commit

Permalink
Re-enable module testing
Browse files Browse the repository at this point in the history
Prepare for compilation with gcc (modules branch).
  • Loading branch information
DanielaE committed Jun 1, 2021
1 parent 8c1b22b commit b6b8e68
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
8 changes: 8 additions & 0 deletions src/fmt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ export module fmt;
#define FMT_END_DETAIL_NAMESPACE \
} \
export {

#if defined(_MSC_FULL_VER) && _MSC_FULL_VER > 192930036
#define FMT_USE_NONTYPE_TEMPLATE_PARAMETERS 0
#endif

// all library-provided declarations and definitions
// must be in the module purview to be exported
#include "fmt/args.h"
Expand All @@ -86,7 +91,10 @@ export module fmt;
#include "fmt/printf.h"
#include "fmt/xchar.h"

// gcc doesn't yet implement private module fragments
#if !FMT_GCC_VERSION
module : private;
#endif

#include "format.cc"
#include "os.cc"
4 changes: 2 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ if (FMT_CAN_MODULE)
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>)
enable_module(test-module)

#add_fmt_test(module-test MODULE)
add_fmt_test(module-test MODULE)
if (MSVC)
target_compile_options(test-module PRIVATE /utf-8)
#target_compile_options(module-test PRIVATE /utf-8)
target_compile_options(module-test PRIVATE /utf-8)
endif ()
endif ()

Expand Down
10 changes: 8 additions & 2 deletions test/module-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
// All Rights Reserved
// {fmt} module.

#ifdef _MSC_FULL_VER
// hide some implementation bugs in msvc
// that are not essential to users of the module.
# define FMT_HIDE_MODULE_BUGS
#endif

#include <bit>
#include <chrono>
#include <exception>
Expand Down Expand Up @@ -405,9 +411,9 @@ TEST(module_test, color) {

TEST(module_test, cstring_view) {
fmt::cstring_view nsv("fmt");
EXPECT_EQ("fmt", nsv.c_str());
EXPECT_EQ("fmt", std::string_view(nsv.c_str()));
fmt::wcstring_view wsv(L"fmt");
EXPECT_EQ(L"fmt", wsv.c_str());
EXPECT_EQ(L"fmt", std::wstring_view(wsv.c_str()));
}

TEST(module_test, buffered_file) {
Expand Down

0 comments on commit b6b8e68

Please sign in to comment.