Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enable module testing #2332

Merged
merged 1 commit into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
14 changes: 10 additions & 4 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 @@ -404,10 +410,10 @@ TEST(module_test, color) {
}

TEST(module_test, cstring_view) {
fmt::cstring_view nsv("fmt");
EXPECT_EQ("fmt", nsv.c_str());
fmt::wcstring_view wsv(L"fmt");
EXPECT_EQ(L"fmt", wsv.c_str());
auto s = "fmt";
EXPECT_EQ(s, fmt::cstring_view(s).c_str());
auto w = L"fmt";
EXPECT_EQ(w, fmt::wcstring_view(w).c_str());
}

TEST(module_test, buffered_file) {
Expand Down