diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index d1316a11..1976f34e 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -21,6 +21,13 @@ jobs: with: submodules: 'recursive' + - name: Select Python 3.10 + if: matrix.os == 'macos-latest' + # otherwise turtlebrowser/get-conan@v1.1 fails on macos-12 + uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Install Conan id: conan uses: turtlebrowser/get-conan@main diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e049b8c..9e17d910 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,23 @@ +X.Y.Z Release notes (YYYY-MM-DD) +============================================================= + +### Fixed +* None + +### Enhancements +* None + +### Breaking changes +* `sync_manager::path_for_realm(const realm::sync_config&)` is now `App::path_for_realm(const realm::sync_config&)` + +### Compatibility +* Fileformat: Generates files with format v24. Reads and automatically upgrade from fileformat v10. + +### Internals +* Upgraded to Core v14.7.0 + +---------------------------------------------- + 1.1.1 Release notes (2024-04-17) ============================================================= diff --git a/Package.swift b/Package.swift index acfd91e3..71dafb39 100644 --- a/Package.swift +++ b/Package.swift @@ -3,7 +3,7 @@ import PackageDescription let sdkVersion = Version("1.1.1") -let coreVersion = Version("14.5.1") +let coreVersion = Version("14.7.0") var cxxSettings: [CXXSetting] = [ .define("REALM_ENABLE_SYNC", to: "1"), @@ -68,13 +68,13 @@ let package = Package( targets: ["realm-cpp-sdk"]), ], dependencies: [ - .package(url: "https://github.com/realm/realm-core.git", revision: "316889b967f845fbc10b4422f96c7eadd47136f2") + .package(url: "https://github.com/realm/realm-core.git", exact: coreVersion) ], targets: [ cppSdkTarget, .target( name: "Catch2Generated", - path: "realm-core/external/generated", + path: "tests/external/generated", // this file was manually generated with catch v3.0.1 // and should be regenerated when catch is upgraded resources: [.copy("catch2/catch_user_config.hpp")], diff --git a/include/cpprealm/app.hpp b/include/cpprealm/app.hpp index 2d0a0726..2711105c 100644 --- a/include/cpprealm/app.hpp +++ b/include/cpprealm/app.hpp @@ -34,10 +34,10 @@ namespace realm { using proxy_config = sync_config::proxy_config; using sync_session = internal::bridge::sync_session; - class SyncUser; namespace app { class App; + class User; struct AppError; }// namespace app namespace internal::bridge { @@ -92,7 +92,7 @@ struct user { user(user&&) = default; user& operator=(const user&) = default; user& operator=(user&&) = default; - explicit user(std::shared_ptr user); + explicit user(std::shared_ptr user); bool is_logged_in() const; /** @@ -133,18 +133,7 @@ struct user { struct internal::bridge::sync_manager sync_manager() const; - [[nodiscard]] db_config flexible_sync_configuration() const - { - db_config config; - config.set_sync_config(sync_config(m_user)); - config.sync_config().set_error_handler([](const sync_session&, const internal::bridge::sync_error& error) { - std::cerr<<"ADS C++ SDK: Sync Error: " << error.message() << "\n"; - }); - config.set_path(sync_manager().path_for_realm(config.sync_config())); - config.sync_config().set_stop_policy(realm::internal::bridge::realm::sync_session_stop_policy::after_changes_uploaded); - config.set_schema_mode(realm::internal::bridge::realm::config::schema_mode::additive_discovered); - return config; - } + [[nodiscard]] db_config flexible_sync_configuration() const; /** Logs out the current user @@ -221,7 +210,7 @@ struct user { */ [[nodiscard]] std::future refresh_custom_user_data() const; - std::shared_ptr m_user; + std::shared_ptr m_user; }; bool operator==(const user& lhs, const user& rhs); @@ -296,8 +285,10 @@ class App { @return A void future once the operation has completed. This handler is executed on the thread the method was called from. */ - [[nodiscard]] std::future update_base_url(std::optional base_url) const; + [[nodiscard]] std::future update_base_url(std::string base_url) const; #endif + + [[nodiscard]] std::string path_for_realm(const realm::sync_config&) const; private: std::shared_ptr m_app; App(std::shared_ptr&& a) : m_app(std::move(a)) { } diff --git a/include/cpprealm/internal/bridge/object.hpp b/include/cpprealm/internal/bridge/object.hpp index 294e553c..fd9bc819 100644 --- a/include/cpprealm/internal/bridge/object.hpp +++ b/include/cpprealm/internal/bridge/object.hpp @@ -146,6 +146,7 @@ namespace realm::internal::bridge { #endif }; struct collection_change_callback { + virtual ~collection_change_callback() {} virtual void before(collection_change_set const& c) = 0; virtual void after(collection_change_set const& c) = 0; }; diff --git a/include/cpprealm/internal/bridge/realm.hpp b/include/cpprealm/internal/bridge/realm.hpp index 73e1b321..927221e9 100644 --- a/include/cpprealm/internal/bridge/realm.hpp +++ b/include/cpprealm/internal/bridge/realm.hpp @@ -33,6 +33,9 @@ namespace realm { struct SyncConfig; struct scheduler; class SyncUser; + namespace app { + class User; + } enum class client_reset_mode: uint8_t { // Fire a client reset error diff --git a/include/cpprealm/internal/bridge/sync_manager.hpp b/include/cpprealm/internal/bridge/sync_manager.hpp index 1c32cc14..f2df6ffa 100644 --- a/include/cpprealm/internal/bridge/sync_manager.hpp +++ b/include/cpprealm/internal/bridge/sync_manager.hpp @@ -31,7 +31,6 @@ namespace realm { namespace internal::bridge { struct sync_manager { - [[nodiscard]] std::string path_for_realm(const realm::sync_config&) const; void set_log_level(logger::level); private: friend class ::realm::App; diff --git a/include/cpprealm/observation.hpp b/include/cpprealm/observation.hpp index 3cc98d64..06f29fc0 100644 --- a/include/cpprealm/observation.hpp +++ b/include/cpprealm/observation.hpp @@ -62,7 +62,7 @@ namespace realm { : block(std::move(b)), object(*obj), m_object(internal_object) { static_cast(obj); } - std::function )> block; + std::function)> block; const T object; std::shared_ptr m_object; diff --git a/realm-core b/realm-core index 316889b9..1f2a4c74 160000 --- a/realm-core +++ b/realm-core @@ -1 +1 @@ -Subproject commit 316889b967f845fbc10b4422f96c7eadd47136f2 +Subproject commit 1f2a4c74112c1988b00a862d348e3f91200c5c4b diff --git a/src/cpprealm/app.cpp b/src/cpprealm/app.cpp index 615f4155..7e4f9a30 100644 --- a/src/cpprealm/app.cpp +++ b/src/cpprealm/app.cpp @@ -6,8 +6,10 @@ #endif #include +#include #include #include +#include #include #include @@ -156,7 +158,7 @@ namespace realm { #endif } - user::user(std::shared_ptr user) : m_user(std::move(user)) + user::user(std::shared_ptr user) : m_user(std::move(user)) { } @@ -166,7 +168,7 @@ namespace realm { */ [[nodiscard]] std::string user::identifier() const { - return m_user->identity(); + return m_user->user_id(); } /** @@ -208,7 +210,7 @@ namespace realm { */ void user::log_out(std::function)>&& callback) const { - m_user->sync_manager()->app().lock()->log_out(m_user, [cb = std::move(callback)](auto error) { + m_user->app()->log_out(m_user, [cb = std::move(callback)](auto error) { cb(error ? std::optional{app_error(std::move(*error))} : std::nullopt); }); } @@ -217,7 +219,7 @@ namespace realm { { std::promise p; std::future f = p.get_future(); - m_user->sync_manager()->app().lock()->log_out(m_user, [p = std::move(p)](auto err) mutable { + m_user->app()->log_out(m_user, [p = std::move(p)](auto err) mutable { if (err) { p.set_exception(std::make_exception_ptr(app_error(std::move(*err)))); } else { @@ -227,6 +229,19 @@ namespace realm { return f; } + db_config user::flexible_sync_configuration() const + { + db_config config; + config.set_sync_config(sync_config(m_user)); + config.sync_config().set_error_handler([](const sync_session&, const internal::bridge::sync_error& error) { + std::cerr << "ADS C++ SDK: Sync Error: " << error.message() << "\n"; + }); + config.set_path(m_user->app()->path_for_realm(*config.sync_config().operator std::shared_ptr())); + config.sync_config().set_stop_policy(realm::internal::bridge::realm::sync_session_stop_policy::after_changes_uploaded); + config.set_schema_mode(realm::internal::bridge::realm::config::schema_mode::additive_discovered); + return config; + } + std::optional user::custom_data() const { if (auto v = m_user->custom_data()) { @@ -248,7 +263,7 @@ namespace realm { void user::call_function(const std::string& name, const std::string& arguments, std::function, std::optional)> callback) const { - m_user->sync_manager()->app().lock()->call_function(m_user, name, arguments, std::nullopt, [cb = std::move(callback)](const std::string* bson_string, + m_user->app()->call_function(m_user, name, arguments, std::nullopt, [cb = std::move(callback)](const std::string* bson_string, std::optional err) { cb(bson_string ? std::optional(*bson_string) : std::nullopt, err); }); @@ -259,7 +274,7 @@ namespace realm { std::promise> p; std::future> f = p.get_future(); - m_user->sync_manager()->app().lock()->call_function(m_user, name, arguments, std::nullopt, [p = std::move(p)](const std::string* bson_string, + m_user->app()->call_function(m_user, name, arguments, std::nullopt, [p = std::move(p)](const std::string* bson_string, std::optional err) mutable { if (err) { p.set_exception(std::make_exception_ptr(app_error(std::move(*err)))); @@ -277,7 +292,7 @@ namespace realm { for(auto& b : args_bson) { core_bson.push_back(b); } - m_user->sync_manager()->app().lock()->call_function(m_user, name, core_bson, std::nullopt, [cb = std::move(callback)](util::Optional&& b, + m_user->app()->call_function(m_user, name, core_bson, std::nullopt, [cb = std::move(callback)](util::Optional&& b, std::optional err) { cb(b ? std::optional(*b) : std::nullopt, err); }); @@ -292,7 +307,7 @@ namespace realm { core_bson.push_back(b); } - m_user->sync_manager()->app().lock()->call_function(m_user, name, core_bson, std::nullopt, [p = std::move(p)](util::Optional&& b, + m_user->app()->call_function(m_user, name, core_bson, std::nullopt, [p = std::move(p)](util::Optional&& b, std::optional err) mutable { if (err) { p.set_exception(std::make_exception_ptr(app_error(std::move(*err)))); @@ -326,7 +341,7 @@ namespace realm { } internal::bridge::sync_manager user::sync_manager() const { - return m_user->sync_manager(); + return std::shared_ptr(m_user->sync_manager()); } bool user::is_logged_in() const { @@ -457,6 +472,8 @@ namespace realm { #if QT_CORE_LIB util::Scheduler::set_default_factory(util::make_qt); #endif + auto app_config = app::AppConfig(); + SyncClientConfig client_config; client_config.logger_factory = ([](::realm::util::Logger::Level level) { auto logger = std::make_unique<::realm::util::ThreadSafeLogger>(std::make_shared()); @@ -470,35 +487,36 @@ namespace realm { #else bool should_encrypt = config.metadata_encryption_key && !getenv("REALM_DISABLE_METADATA_ENCRYPTION"); #endif - client_config.metadata_mode = should_encrypt ? SyncManager::MetadataMode::Encryption : SyncManager::MetadataMode::NoEncryption; - if (config.metadata_encryption_key) { - auto key = std::vector(); - key.resize(64); - key.assign(config.metadata_encryption_key->begin(), config.metadata_encryption_key->end()); - client_config.custom_encryption_key = std::move(key); - } #ifdef QT_CORE_LIB auto qt_path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation).toStdString(); if (!std::filesystem::exists(qt_path)) { std::filesystem::create_directory(qt_path); } - config.base_file_path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation).toStdString(); + app_config.base_file_path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation).toStdString(); #else if (config.path) { - client_config.base_file_path = *config.path; + app_config.base_file_path = *config.path; } else { - client_config.base_file_path = std::filesystem::current_path().make_preferred().generic_string(); + app_config.base_file_path = std::filesystem::current_path().make_preferred().generic_string(); } #endif client_config.user_agent_binding_info = std::string("RealmCpp/") + std::string(REALMCXX_VERSION_STRING); client_config.user_agent_application_info = config.app_id; - auto app_config = app::App::Config(); app_config.app_id = config.app_id; app_config.transport = std::make_shared(config.custom_http_headers, config.proxy_configuration); app_config.base_url = config.base_url; - auto device_info = app::App::Config::DeviceInfo(); + + app_config.metadata_mode = should_encrypt ? app::AppConfig::MetadataMode::Encryption : app::AppConfig::MetadataMode::NoEncryption; + if (config.metadata_encryption_key) { + auto key = std::vector(); + key.resize(64); + key.assign(config.metadata_encryption_key->begin(), config.metadata_encryption_key->end()); + app_config.custom_encryption_key = std::move(key); + } + + auto device_info = app::AppConfig::DeviceInfo(); device_info.framework_name = "Realm Cpp", device_info.platform_version = "?", @@ -506,7 +524,8 @@ namespace realm { device_info.sdk = "Realm Cpp"; app_config.device_info = std::move(device_info); - m_app = app::App::get_app(app::App::CacheMode::Enabled, std::move(app_config), client_config); + app_config.sync_client_config = client_config; + m_app = app::App::get_app(app::App::CacheMode::Enabled, std::move(app_config)); } App::App(const std::string &app_id, @@ -525,6 +544,10 @@ namespace realm { return m_app->get_base_url(); } + [[nodiscard]] std::string App::path_for_realm(const realm::sync_config& c) const { + return m_app->path_for_realm(*c.operator std::shared_ptr()); + } + std::future App::register_user(const std::string &username, const std::string &password) { std::promise p; std::future f = p.get_future(); @@ -570,7 +593,7 @@ namespace realm { } std::optional App::get_current_user() const { - if (auto u = m_app->sync_manager()->get_current_user()) { + if (auto u = m_app->current_user()) { return user(u); } return std::nullopt; @@ -587,7 +610,7 @@ namespace realm { } #ifdef REALM_ENABLE_EXPERIMENTAL - [[nodiscard]] std::future App::update_base_url(std::optional base_url) const { + [[nodiscard]] std::future App::update_base_url(std::string base_url) const { std::promise p; std::future f = p.get_future(); m_app->update_base_url(base_url, ([p = std::move(p)](auto err) mutable { diff --git a/src/cpprealm/internal/bridge/query.cpp b/src/cpprealm/internal/bridge/query.cpp index 03f7a1e9..2252de80 100644 --- a/src/cpprealm/internal/bridge/query.cpp +++ b/src/cpprealm/internal/bridge/query.cpp @@ -18,9 +18,15 @@ return *this; \ } -#define __generate_query_operator_case_sensitive(op, type) \ - query &query::op(col_key column_key, type value, bool) { \ - this->operator=(get_query()->op(column_key, value)); \ +#define __generate_string_query_operator_case_sensitive(op, type) \ + query &query::op(col_key column_key, type value, bool case_sensistive) { \ + this->operator=(get_query()->op(column_key, StringData(value), case_sensistive)); \ + return *this; \ + } + +#define __generate_binary_query_operator_case_sensitive(op, type) \ + query &query::op(col_key column_key, type value, bool case_sensistive) { \ + this->operator=(get_query()->op(column_key, BinaryData(value), case_sensistive)); \ return *this; \ } @@ -597,15 +603,15 @@ namespace realm::internal::bridge { #endif } - __generate_query_operator_case_sensitive(equal, std::string_view) - __generate_query_operator_case_sensitive(not_equal, std::string_view) - __generate_query_operator_case_sensitive(contains, std::string_view) + __generate_string_query_operator_case_sensitive(equal, std::string_view) + __generate_string_query_operator_case_sensitive(not_equal, std::string_view) + __generate_string_query_operator_case_sensitive(contains, std::string_view) __generate_query_operator_mixed(equal) __generate_query_operator_mixed(not_equal) - __generate_query_operator_case_sensitive(equal, binary) - __generate_query_operator_case_sensitive(not_equal, binary) + __generate_binary_query_operator_case_sensitive(equal, binary) + __generate_binary_query_operator_case_sensitive(not_equal, binary) query operator||(query const& lhs, query const& rhs) { return static_cast(lhs) || static_cast(rhs); diff --git a/src/cpprealm/internal/bridge/realm.cpp b/src/cpprealm/internal/bridge/realm.cpp index 66d060bc..434656ef 100644 --- a/src/cpprealm/internal/bridge/realm.cpp +++ b/src/cpprealm/internal/bridge/realm.cpp @@ -517,10 +517,8 @@ namespace realm::internal::bridge { if (!config) { return std::nullopt; } - if (auto session = config->user->session_for_on_disk_path(m_realm->config().path)) { - return sync_session(std::move(session)); - } - return std::nullopt; + + return sync_session(m_realm->sync_session()); } table realm::get_table(const uint32_t &key) { diff --git a/src/cpprealm/internal/bridge/sync_manager.cpp b/src/cpprealm/internal/bridge/sync_manager.cpp index 2182f47b..701e682b 100644 --- a/src/cpprealm/internal/bridge/sync_manager.cpp +++ b/src/cpprealm/internal/bridge/sync_manager.cpp @@ -3,9 +3,6 @@ namespace realm::internal::bridge { - std::string sync_manager::path_for_realm(const realm::sync_config &v) const { - return m_manager->path_for_realm(*static_cast>(v)); - } sync_manager::sync_manager(const std::shared_ptr &v) { m_manager = v; diff --git a/src/cpprealm/internal/network/network_transport.cpp b/src/cpprealm/internal/network/network_transport.cpp index 2de8c868..f5d0cc61 100644 --- a/src/cpprealm/internal/network/network_transport.cpp +++ b/src/cpprealm/internal/network/network_transport.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include diff --git a/tests/external/generated/Dummy.m b/tests/external/generated/Dummy.m new file mode 100644 index 00000000..1cb3b1d4 --- /dev/null +++ b/tests/external/generated/Dummy.m @@ -0,0 +1,2 @@ +// This is required so that Catch2Generated is built as a binary as +// well as a resource bundle. diff --git a/tests/external/generated/catch2/catch_user_config.hpp b/tests/external/generated/catch2/catch_user_config.hpp new file mode 100644 index 00000000..0c35092c --- /dev/null +++ b/tests/external/generated/catch2/catch_user_config.hpp @@ -0,0 +1,178 @@ +// Note to Realm C++ maintainers: +// this file was manually generated from Realm Core with catch v3.0.1 +// it is needed for the Package.swift build system and +// should be regenerated if we upgrade catch again. + + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +/**\file + * **AUTOGENERATED FROM CMAKE CONFIGURATION** + * + * Contains materialized compile-time configuration provided to Catch2's + * CMake configuration. All compile-time configuration options need to + * be here, and also documented in `docs/configuration.md`. + */ + +#ifndef CATCH_USER_CONFIG_HPP_INCLUDED +#define CATCH_USER_CONFIG_HPP_INCLUDED + + +// ------ +// Overridable compilation flags, +// these can have 3 "states": Force Yes, Force No, Use Default. +// Setting both Force Yes and Force No is an error +// ------ + +/* #undef CATCH_CONFIG_ANDROID_LOGWRITE */ +/* #undef CATCH_CONFIG_NO_ANDROID_LOGWRITE */ + +#if defined(CATCH_CONFIG_ANDROID_LOGWRITE) && defined(CATCH_CONFIG_NO_ANDROID_LOGWRITE) +#error Cannot force ANDROID_LOGWRITE to both ON and OFF +#endif + +/* #undef CATCH_CONFIG_COLOUR_WIN32 */ +/* #undef CATCH_CONFIG_NO_COLOUR_WIN32 */ + +#if defined(CATCH_CONFIG_COLOUR_WIN32) && defined(CATCH_CONFIG_NO_COLOUR_WIN32) +#error Cannot force COLOUR_WIN32 to be ON and OFF +#endif + +/* #undef CATCH_CONFIG_COUNTER */ +/* #undef CATCH_CONFIG_NO_COUNTER */ + +#if defined(CATCH_CONFIG_COUNTER) && defined(CATCH_CONFIG_NO_COUNTER) +#error Cannot force COUNTER to both ON and OFF +#endif + + +/* #undef CATCH_CONFIG_CPP11_TO_STRING */ +/* #undef CATCH_CONFIG_NO_CPP11_TO_STRING */ + +#if defined(CATCH_CONFIG_CPP11_TO_STRING) && defined(CATCH_CONFIG_NO_CPP11_TO_STRING) +#error Cannot force CPP11_TO_STRING to both ON and OFF +#endif + + +/* #undef CATCH_CONFIG_CPP17_BYTE */ +/* #undef CATCH_CONFIG_NO_CPP17_BYTE */ + +#if defined(CATCH_CONFIG_CPP17_BYTE) && defined(CATCH_CONFIG_NO_CPP17_BYTE) +#error Cannot force CPP17_BYTE to both ON and OFF +#endif + + +/* #undef CATCH_CONFIG_CPP17_OPTIONAL */ +/* #undef CATCH_CONFIG_NO_CPP17_OPTIONAL */ + +#if defined(CATCH_CONFIG_CPP17_OPTIONAL) && defined(CATCH_CONFIG_NO_CPP17_OPTIONAL) +#error Cannot force CPP17_OPTIONAL to both ON and OFF +#endif + + +/* #undef CATCH_CONFIG_CPP17_STRING_VIEW */ +/* #undef CATCH_CONFIG_NO_CPP17_STRING_VIEW */ + +#if defined(CATCH_CONFIG_CPP17_STRING_VIEW) && defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) +#error Cannot force CPP17_STRING_VIEW to both ON and OFF +#endif + + +/* #undef CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS */ +/* #undef CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS */ + +#if defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) && defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) +#error Cannot force CPP17_UNCAUGHT_EXCEPTIONS to both ON and OFF +#endif + + +/* #undef CATCH_CONFIG_CPP17_VARIANT */ +/* #undef CATCH_CONFIG_NO_CPP17_VARIANT */ + +#if defined(CATCH_CONFIG_CPP17_VARIANT) && defined(CATCH_CONFIG_NO_CPP17_VARIANT) +#error Cannot force CPP17_VARIANT to both ON and OFF +#endif + + +/* #undef CATCH_CONFIG_GLOBAL_NEXTAFTER */ +/* #undef CATCH_CONFIG_NO_GLOBAL_NEXTAFTER */ + +#if defined(CATCH_CONFIG_GLOBAL_NEXTAFTER) && defined(CATCH_CONFIG_NO_GLOBAL_NEXTAFTER) +#error Cannot force GLOBAL_NEXTAFTER to both ON and OFF +#endif + + +/* #undef CATCH_CONFIG_POSIX_SIGNALS */ +/* #undef CATCH_CONFIG_NO_POSIX_SIGNALS */ + +#if defined(CATCH_CONFIG_POSIX_SIGNALS) && defined(CATCH_CONFIG_NO_POSIX_SIGNALS) +#error Cannot force POSIX_SIGNALS to both ON and OFF +#endif + + +/* #undef CATCH_CONFIG_USE_ASYNC */ +/* #undef CATCH_CONFIG_NO_USE_ASYNC */ + +#if defined(CATCH_CONFIG_USE_ASYNC) && defined(CATCH_CONFIG_NO_USE_ASYNC) +#error Cannot force USE_ASYNC to both ON and OFF +#endif + + +/* #undef CATCH_CONFIG_WCHAR */ +/* #undef CATCH_CONFIG_NO_WCHAR */ + +#if defined(CATCH_CONFIG_WCHAR) && defined(CATCH_CONFIG_NO_WCHAR) +#error Cannot force WCHAR to both ON and OFF +#endif + + +/* #undef CATCH_CONFIG_WINDOWS_SEH */ +/* #undef CATCH_CONFIG_NO_WINDOWS_SEH */ + +#if defined(CATCH_CONFIG_WINDOWS_SEH) && defined(CATCH_CONFIG_NO_WINDOWS_SEH) +#error Cannot force WINDOWS_SEH to both ON and OFF +#endif + + +// ------ +// Simple toggle defines +// their value is never used and they cannot be overriden +// ------ + + +/* #undef CATCH_CONFIG_BAZEL_SUPPORT */ +/* #undef CATCH_CONFIG_DISABLE_EXCEPTIONS */ +/* #undef CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER */ +/* #undef CATCH_CONFIG_DISABLE */ +/* #undef CATCH_CONFIG_DISABLE_STRINGIFICATION */ +/* #undef CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS */ +/* #undef CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER */ +/* #undef CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER */ +/* #undef CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER */ +/* #undef CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER */ +/* #undef CATCH_CONFIG_EXPERIMENTAL_REDIRECT */ +/* #undef CATCH_CONFIG_FAST_COMPILE */ +/* #undef CATCH_CONFIG_NOSTDOUT */ +/* #undef CATCH_CONFIG_PREFIX_ALL */ +/* #undef CATCH_CONFIG_WINDOWS_CRTDBG */ + + +// ------ +// "Variable" defines, these have actual values +// ------ + +#define CATCH_CONFIG_DEFAULT_REPORTER "console" +#define CATCH_CONFIG_CONSOLE_WIDTH 80 + +// Unlike the macros above, CATCH_CONFIG_FALLBACK_STRINGIFIER does not +// have a good default value, so we cannot always define it, and cannot +// even expose it as a variable in CMake. The users will have to find +// out about it from docs and set it only if they use it. +/* #undef CATCH_CONFIG_FALLBACK_STRINGIFIER */ + +#endif // CATCH_USER_CONFIG_HPP_INCLUDED diff --git a/tests/sync/app_tests.cpp b/tests/sync/app_tests.cpp index 21c77bee..7b9f17c3 100644 --- a/tests/sync/app_tests.cpp +++ b/tests/sync/app_tests.cpp @@ -92,7 +92,7 @@ TEST_CASE("app", "[app]") { REQUIRE_THROWS_AS(app.update_base_url("https://foobar.com").get(), realm::app_error); CHECK(app.get_base_url() == Admin::Session::shared().base_url()); // Cannot be changed because app id not available in atlas - REQUIRE_THROWS_AS(app.update_base_url(std::nullopt).get(), realm::app_error); + REQUIRE_THROWS_AS(app.update_base_url("").get(), realm::app_error); CHECK(app.get_base_url() == Admin::Session::shared().base_url()); // This succeeds but the url is the same app.update_base_url(Admin::Session::shared().base_url()).get(); @@ -143,10 +143,6 @@ TEST_CASE("app", "[app]") { CHECK(e->message().find("404 message: cannot find app using Client App ID 'NA'")); error_promise.set_value(); }); - - auto user = app.login(realm::App::credentials::anonymous()).get(); - user.log_out().get(); - REQUIRE_THROWS(user.log_out().get()); } SECTION("auth_providers_promise") {