From 85336bfc3e21d14bd17b4adef0297cf49efade36 Mon Sep 17 00:00:00 2001 From: Dominik Charousset Date: Sun, 16 Jun 2024 15:22:52 +0200 Subject: [PATCH] Fix build on MSVC --- libbroker/broker/convert.hh | 5 +++-- libbroker/broker/detail/sqlite_backend.cc | 2 +- libbroker/broker/master.test.cc | 21 +++++++++++---------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/libbroker/broker/convert.hh b/libbroker/broker/convert.hh index 0fe5bb8c..41177ddd 100644 --- a/libbroker/broker/convert.hh +++ b/libbroker/broker/convert.hh @@ -130,8 +130,9 @@ template std::enable_if_t< detail::has_convert_v // must have a convert function && !std::is_arithmetic_v // avoid ambiguitiy with default overloads - && !std::is_convertible_v, // avoid ambiguity with - // conversion-to-string + && !std::is_convertible_v // avoid ambiguity with + // conversion-to-string + && !std::is_same_v, std::ostream&> operator<<(std::ostream& os, const T& x) { std::string str; diff --git a/libbroker/broker/detail/sqlite_backend.cc b/libbroker/broker/detail/sqlite_backend.cc index bc0d1e64..b0d07411 100644 --- a/libbroker/broker/detail/sqlite_backend.cc +++ b/libbroker/broker/detail/sqlite_backend.cc @@ -283,7 +283,7 @@ struct sqlite_backend::impl { if (!detail::is_directory(dir) && !detail::mkdirs(dir)) { log::store::error("sqlite-create-dir-failed", "failed to create directory for database: {}", - dir.c_str()); + dir.string()); return false; } } diff --git a/libbroker/broker/master.test.cc b/libbroker/broker/master.test.cc index 9016586f..f0e48ac3 100644 --- a/libbroker/broker/master.test.cc +++ b/libbroker/broker/master.test.cc @@ -85,7 +85,7 @@ bool operator==(const string_list& xs, const pattern_list& ys) { } struct fixture : base_fixture { - string_list log; + string_list log_lines; worker logger; caf::timespan tick_interval = defaults::store::tick_interval; @@ -100,11 +100,11 @@ struct fixture : base_fixture { [this](data_message msg) { auto content = get_data(msg).to_data(); if (auto insert = store_event::insert::make(content)) - log.emplace_back(to_string(insert)); + log_lines.emplace_back(to_string(insert)); else if (auto update = store_event::update::make(content)) - log.emplace_back(to_string(update)); + log_lines.emplace_back(to_string(update)); else if (auto erase = store_event::erase::make(content)) - log.emplace_back(to_string(erase)); + log_lines.emplace_back(to_string(erase)); else FAIL("unknown event: " << to_string(content)); }, @@ -162,12 +162,13 @@ TEST(local_master) { CHECK_EQUAL(unbox(ds.put_unique("bar", "unicorn")), data{false}); // check log run(tick_interval); - CHECK_EQUAL(log, pattern_list({ - "insert\\(foo, hello, world, (null|none), .+\\)", - "update\\(foo, hello, world, universe, (null|none), .+\\)", - "erase\\(foo, hello, .+\\)", - "insert\\(foo, bar, baz, .+\\)", - })); + CHECK_EQUAL(log_lines, + pattern_list({ + "insert\\(foo, hello, world, (null|none), .+\\)", + "update\\(foo, hello, world, universe, (null|none), .+\\)", + "erase\\(foo, hello, .+\\)", + "insert\\(foo, bar, baz, .+\\)", + })); // done caf::anon_send_exit(core, caf::exit_reason::user_shutdown); }