diff --git a/.mapping.json b/.mapping.json index 2c0bebd7c76f..a0774cc437bd 100644 --- a/.mapping.json +++ b/.mapping.json @@ -580,13 +580,6 @@ "core/include/userver/utils/statistics/writer.hpp":"taxi/uservices/userver/core/include/userver/utils/statistics/writer.hpp", "core/include/userver/utils/text.hpp":"taxi/uservices/userver/core/include/userver/utils/text.hpp", "core/include/userver/utils/userver_info.hpp":"taxi/uservices/userver/core/include/userver/utils/userver_info.hpp", - "core/include/userver/yaml_config/fwd.hpp":"taxi/uservices/userver/core/include/userver/yaml_config/fwd.hpp", - "core/include/userver/yaml_config/impl/validate_static_config.hpp":"taxi/uservices/userver/core/include/userver/yaml_config/impl/validate_static_config.hpp", - "core/include/userver/yaml_config/iterator.hpp":"taxi/uservices/userver/core/include/userver/yaml_config/iterator.hpp", - "core/include/userver/yaml_config/map_to_array.hpp":"taxi/uservices/userver/core/include/userver/yaml_config/map_to_array.hpp", - "core/include/userver/yaml_config/merge_schemas.hpp":"taxi/uservices/userver/core/include/userver/yaml_config/merge_schemas.hpp", - "core/include/userver/yaml_config/schema.hpp":"taxi/uservices/userver/core/include/userver/yaml_config/schema.hpp", - "core/include/userver/yaml_config/yaml_config.hpp":"taxi/uservices/userver/core/include/userver/yaml_config/yaml_config.hpp", "core/internal/include/userver/engine/task/task_processor_utils.hpp":"taxi/uservices/userver/core/internal/include/userver/engine/task/task_processor_utils.hpp", "core/internal/include/userver/internal/net/net_listener.hpp":"taxi/uservices/userver/core/internal/include/userver/internal/net/net_listener.hpp", "core/internal/src/net/net_listener.cpp":"taxi/uservices/userver/core/internal/src/net/net_listener.cpp", @@ -1334,20 +1327,11 @@ "core/src/utils/text.cpp":"taxi/uservices/userver/core/src/utils/text.cpp", "core/src/utils/text_test.cpp":"taxi/uservices/userver/core/src/utils/text_test.cpp", "core/src/utils/userver_info.cpp":"taxi/uservices/userver/core/src/utils/userver_info.cpp", - "core/src/yaml_config/impl/validate_static_config.cpp":"taxi/uservices/userver/core/src/yaml_config/impl/validate_static_config.cpp", - "core/src/yaml_config/impl/validate_static_config_test.cpp":"taxi/uservices/userver/core/src/yaml_config/impl/validate_static_config_test.cpp", - "core/src/yaml_config/iterator.cpp":"taxi/uservices/userver/core/src/yaml_config/iterator.cpp", - "core/src/yaml_config/merge_schemas.cpp":"taxi/uservices/userver/core/src/yaml_config/merge_schemas.cpp", - "core/src/yaml_config/merge_schemas_test.cpp":"taxi/uservices/userver/core/src/yaml_config/merge_schemas_test.cpp", - "core/src/yaml_config/schema.cpp":"taxi/uservices/userver/core/src/yaml_config/schema.cpp", - "core/src/yaml_config/yaml_config.cpp":"taxi/uservices/userver/core/src/yaml_config/yaml_config.cpp", - "core/src/yaml_config/yaml_config_test.cpp":"taxi/uservices/userver/core/src/yaml_config/yaml_config_test.cpp", "core/sys_coro/include/coroutines/coroutine.hpp":"taxi/uservices/userver/core/sys_coro/include/coroutines/coroutine.hpp", "core/testing/include/userver/cache/statistics_mock.hpp":"taxi/uservices/userver/core/testing/include/userver/cache/statistics_mock.hpp", "core/testing/include/userver/dump/operations_mock.hpp":"taxi/uservices/userver/core/testing/include/userver/dump/operations_mock.hpp", "core/testing/include/userver/dump/test_helpers.hpp":"taxi/uservices/userver/core/testing/include/userver/dump/test_helpers.hpp", "core/testing/include/userver/dynamic_config/test_helpers.hpp":"taxi/uservices/userver/core/testing/include/userver/dynamic_config/test_helpers.hpp", - "core/testing/include/userver/utest/assert_macros.hpp":"taxi/uservices/userver/core/testing/include/userver/utest/assert_macros.hpp", "core/testing/include/userver/utest/current_process_open_files.hpp":"taxi/uservices/userver/core/testing/include/userver/utest/current_process_open_files.hpp", "core/testing/include/userver/utest/default_logger_fixture.hpp":"taxi/uservices/userver/core/testing/include/userver/utest/default_logger_fixture.hpp", "core/testing/include/userver/utest/dns_server_mock.hpp":"taxi/uservices/userver/core/testing/include/userver/utest/dns_server_mock.hpp", @@ -1363,8 +1347,6 @@ "core/testing/src/dump/operations_mock.cpp":"taxi/uservices/userver/core/testing/src/dump/operations_mock.cpp", "core/testing/src/dump/operations_mock_test.cpp":"taxi/uservices/userver/core/testing/src/dump/operations_mock_test.cpp", "core/testing/src/dynamic_config/test_helpers_test.cpp":"taxi/uservices/userver/core/testing/src/dynamic_config/test_helpers_test.cpp", - "core/testing/src/utest/assert_macros.cpp":"taxi/uservices/userver/core/testing/src/utest/assert_macros.cpp", - "core/testing/src/utest/assert_macros_test.cpp":"taxi/uservices/userver/core/testing/src/utest/assert_macros_test.cpp", "core/testing/src/utest/current_process_open_files.cpp":"taxi/uservices/userver/core/testing/src/utest/current_process_open_files.cpp", "core/testing/src/utest/current_process_open_files_test.cpp":"taxi/uservices/userver/core/testing/src/utest/current_process_open_files_test.cpp", "core/testing/src/utest/dns_server_mock.cpp":"taxi/uservices/userver/core/testing/src/utest/dns_server_mock.cpp", @@ -3142,7 +3124,9 @@ "universal/include/userver/logging/log_helper_fwd.hpp":"taxi/uservices/userver/universal/include/userver/logging/log_helper_fwd.hpp", "universal/include/userver/logging/null_logger.hpp":"taxi/uservices/userver/universal/include/userver/logging/null_logger.hpp", "universal/include/userver/logging/stacktrace_cache.hpp":"taxi/uservices/userver/universal/include/userver/logging/stacktrace_cache.hpp", + "universal/include/userver/utest/assert_macros.hpp":"taxi/uservices/userver/universal/include/userver/utest/assert_macros.hpp", "universal/include/userver/utest/death_tests.hpp":"taxi/uservices/userver/universal/include/userver/utest/death_tests.hpp", + "universal/include/userver/utest/impl/assert_macros.hpp":"taxi/uservices/userver/universal/include/userver/utest/impl/assert_macros.hpp", "universal/include/userver/utest/literals.hpp":"taxi/uservices/userver/universal/include/userver/utest/literals.hpp", "universal/include/userver/utest/using_namespace_userver.hpp":"taxi/uservices/userver/universal/include/userver/utest/using_namespace_userver.hpp", "universal/include/userver/utils/algo.hpp":"taxi/uservices/userver/universal/include/userver/utils/algo.hpp", @@ -3218,6 +3202,13 @@ "universal/include/userver/utils/underlying_value.hpp":"taxi/uservices/userver/universal/include/userver/utils/underlying_value.hpp", "universal/include/userver/utils/uuid4.hpp":"taxi/uservices/userver/universal/include/userver/utils/uuid4.hpp", "universal/include/userver/utils/void_t.hpp":"taxi/uservices/userver/universal/include/userver/utils/void_t.hpp", + "universal/include/userver/yaml_config/fwd.hpp":"taxi/uservices/userver/universal/include/userver/yaml_config/fwd.hpp", + "universal/include/userver/yaml_config/impl/validate_static_config.hpp":"taxi/uservices/userver/universal/include/userver/yaml_config/impl/validate_static_config.hpp", + "universal/include/userver/yaml_config/iterator.hpp":"taxi/uservices/userver/universal/include/userver/yaml_config/iterator.hpp", + "universal/include/userver/yaml_config/map_to_array.hpp":"taxi/uservices/userver/universal/include/userver/yaml_config/map_to_array.hpp", + "universal/include/userver/yaml_config/merge_schemas.hpp":"taxi/uservices/userver/universal/include/userver/yaml_config/merge_schemas.hpp", + "universal/include/userver/yaml_config/schema.hpp":"taxi/uservices/userver/universal/include/userver/yaml_config/schema.hpp", + "universal/include/userver/yaml_config/yaml_config.hpp":"taxi/uservices/userver/universal/include/userver/yaml_config/yaml_config.hpp", "universal/internal/include/userver/internal/http/header_map_tests_helper.hpp":"taxi/uservices/userver/universal/internal/include/userver/internal/http/header_map_tests_helper.hpp", "universal/internal/src/http/header_map_tests_helper.cpp":"taxi/uservices/userver/universal/internal/src/http/header_map_tests_helper.cpp", "universal/library.yaml":"taxi/uservices/userver/universal/library.yaml", @@ -3378,6 +3369,8 @@ "universal/src/logging/rate_limit.cpp":"taxi/uservices/userver/universal/src/logging/rate_limit.cpp", "universal/src/logging/rate_limit.hpp":"taxi/uservices/userver/universal/src/logging/rate_limit.hpp", "universal/src/logging/stacktrace_cache.cpp":"taxi/uservices/userver/universal/src/logging/stacktrace_cache.cpp", + "universal/src/utest/assert_macros.cpp":"taxi/uservices/userver/universal/src/utest/assert_macros.cpp", + "universal/src/utest/assert_macros_test.cpp":"taxi/uservices/userver/universal/src/utest/assert_macros_test.cpp", "universal/src/utils/algo_test.cpp":"taxi/uservices/userver/universal/src/utils/algo_test.cpp", "universal/src/utils/any_movable.cpp":"taxi/uservices/userver/universal/src/utils/any_movable.cpp", "universal/src/utils/any_movable_test.cpp":"taxi/uservices/userver/universal/src/utils/any_movable_test.cpp", @@ -3476,5 +3469,13 @@ "universal/src/utils/uuid4.cpp":"taxi/uservices/userver/universal/src/utils/uuid4.cpp", "universal/src/utils/uuid4_test.cpp":"taxi/uservices/userver/universal/src/utils/uuid4_test.cpp", "universal/src/utils/widget_fast_pimpl_test.cpp":"taxi/uservices/userver/universal/src/utils/widget_fast_pimpl_test.cpp", - "universal/src/utils/widget_fast_pimpl_test.hpp":"taxi/uservices/userver/universal/src/utils/widget_fast_pimpl_test.hpp" + "universal/src/utils/widget_fast_pimpl_test.hpp":"taxi/uservices/userver/universal/src/utils/widget_fast_pimpl_test.hpp", + "universal/src/yaml_config/impl/validate_static_config.cpp":"taxi/uservices/userver/universal/src/yaml_config/impl/validate_static_config.cpp", + "universal/src/yaml_config/impl/validate_static_config_test.cpp":"taxi/uservices/userver/universal/src/yaml_config/impl/validate_static_config_test.cpp", + "universal/src/yaml_config/iterator.cpp":"taxi/uservices/userver/universal/src/yaml_config/iterator.cpp", + "universal/src/yaml_config/merge_schemas.cpp":"taxi/uservices/userver/universal/src/yaml_config/merge_schemas.cpp", + "universal/src/yaml_config/merge_schemas_test.cpp":"taxi/uservices/userver/universal/src/yaml_config/merge_schemas_test.cpp", + "universal/src/yaml_config/schema.cpp":"taxi/uservices/userver/universal/src/yaml_config/schema.cpp", + "universal/src/yaml_config/yaml_config.cpp":"taxi/uservices/userver/universal/src/yaml_config/yaml_config.cpp", + "universal/src/yaml_config/yaml_config_test.cpp":"taxi/uservices/userver/universal/src/yaml_config/yaml_config_test.cpp" } \ No newline at end of file diff --git a/core/testing/include/userver/utest/assert_macros.hpp b/universal/include/userver/utest/assert_macros.hpp similarity index 81% rename from core/testing/include/userver/utest/assert_macros.hpp rename to universal/include/userver/utest/assert_macros.hpp index 64566b20e1b8..21c55c9a7b07 100644 --- a/core/testing/include/userver/utest/assert_macros.hpp +++ b/universal/include/userver/utest/assert_macros.hpp @@ -2,6 +2,8 @@ /// @file userver/utest/assert_macros.hpp /// @brief Extensions to the gtest macros for printing and testing exceptions +/// that could work even without coroutine environment. +/// @ingroup userver_universal #include #include @@ -13,37 +15,9 @@ #include #include +#include #include -USERVER_NAMESPACE_BEGIN - -namespace utest::impl { - -template -bool IsSubtype(const std::exception& ex) noexcept { - static_assert( - std::is_base_of_v, - "Exception types not inherited from std::exception are not supported"); - if constexpr (std::is_same_v) { - return true; - } else { - return dynamic_cast(&ex) != nullptr; - } -} - -std::string AssertThrow(std::function statement, - std::string_view statement_text, - std::function type_checker, - const std::type_info& expected_type, - std::string_view message_substring); - -std::string AssertNoThrow(std::function statement, - std::string_view statement_text); - -} // namespace utest::impl - -USERVER_NAMESPACE_END - /// @cond // NOLINTNEXTLINE (cppcoreguidelines-macro-usage) #define IMPL_UTEST_ASSERT_THROW(statement, exception_type, message_substring, \ diff --git a/universal/include/userver/utest/death_tests.hpp b/universal/include/userver/utest/death_tests.hpp index 9acca8dc03b8..33accfe3e1a7 100644 --- a/universal/include/userver/utest/death_tests.hpp +++ b/universal/include/userver/utest/death_tests.hpp @@ -2,6 +2,7 @@ /// @file userver/utest/death_tests.hpp /// @brief Contains facilities for testing service crashes +/// @ingroup userver_universal #include @@ -29,7 +30,7 @@ class DeathTestScope final { USERVER_NAMESPACE_END -/// @ingroup userver_universal userver_utest +/// @ingroup userver_utest /// /// @brief An optimized equivalent of EXPECT_DEATH. /// diff --git a/universal/include/userver/utest/impl/assert_macros.hpp b/universal/include/userver/utest/impl/assert_macros.hpp new file mode 100644 index 000000000000..bd96826de5c6 --- /dev/null +++ b/universal/include/userver/utest/impl/assert_macros.hpp @@ -0,0 +1,37 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +USERVER_NAMESPACE_BEGIN + +namespace utest::impl { + +template +bool IsSubtype(const std::exception& ex) noexcept { + static_assert( + std::is_base_of_v, + "Exception types not inherited from std::exception are not supported"); + if constexpr (std::is_same_v) { + return true; + } else { + return dynamic_cast(&ex) != nullptr; + } +} + +std::string AssertThrow(std::function statement, + std::string_view statement_text, + std::function type_checker, + const std::type_info& expected_type, + std::string_view message_substring); + +std::string AssertNoThrow(std::function statement, + std::string_view statement_text); + +} // namespace utest::impl + +USERVER_NAMESPACE_END diff --git a/universal/include/userver/utest/using_namespace_userver.hpp b/universal/include/userver/utest/using_namespace_userver.hpp index 172a929c2ce2..edfb63682c37 100644 --- a/universal/include/userver/utest/using_namespace_userver.hpp +++ b/universal/include/userver/utest/using_namespace_userver.hpp @@ -3,6 +3,7 @@ /// @file userver/utest/using_namespace_userver.hpp /// @brief For samples and snippets only! Has a `using namespace /// USERVER_NAMESPACE;` if the USERVER_NAMESPACE is not empty. +/// @ingroup userver_universal // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define USERVER_IS_EMPTY_MACRO_HELPER(X) X##1 diff --git a/core/include/userver/yaml_config/fwd.hpp b/universal/include/userver/yaml_config/fwd.hpp similarity index 90% rename from core/include/userver/yaml_config/fwd.hpp rename to universal/include/userver/yaml_config/fwd.hpp index 86e56c99cc71..47774cc7aab0 100644 --- a/core/include/userver/yaml_config/fwd.hpp +++ b/universal/include/userver/yaml_config/fwd.hpp @@ -2,6 +2,7 @@ /// @file userver/yaml_config/fwd.hpp /// @brief Forward declarations of YamlConfig type and formats::parse::To. +/// @ingroup userver_universal #include diff --git a/core/include/userver/yaml_config/impl/validate_static_config.hpp b/universal/include/userver/yaml_config/impl/validate_static_config.hpp similarity index 100% rename from core/include/userver/yaml_config/impl/validate_static_config.hpp rename to universal/include/userver/yaml_config/impl/validate_static_config.hpp diff --git a/core/include/userver/yaml_config/iterator.hpp b/universal/include/userver/yaml_config/iterator.hpp similarity index 100% rename from core/include/userver/yaml_config/iterator.hpp rename to universal/include/userver/yaml_config/iterator.hpp diff --git a/core/include/userver/yaml_config/map_to_array.hpp b/universal/include/userver/yaml_config/map_to_array.hpp similarity index 100% rename from core/include/userver/yaml_config/map_to_array.hpp rename to universal/include/userver/yaml_config/map_to_array.hpp diff --git a/core/include/userver/yaml_config/merge_schemas.hpp b/universal/include/userver/yaml_config/merge_schemas.hpp similarity index 95% rename from core/include/userver/yaml_config/merge_schemas.hpp rename to universal/include/userver/yaml_config/merge_schemas.hpp index 1d30ca4cfe66..d2254863f71b 100644 --- a/core/include/userver/yaml_config/merge_schemas.hpp +++ b/universal/include/userver/yaml_config/merge_schemas.hpp @@ -2,6 +2,7 @@ /// @file userver/yaml_config/merge_schemas.hpp /// @brief @copybrief yaml_config::MergeSchemas +/// @ingroup userver_universal #include diff --git a/core/include/userver/yaml_config/schema.hpp b/universal/include/userver/yaml_config/schema.hpp similarity index 98% rename from core/include/userver/yaml_config/schema.hpp rename to universal/include/userver/yaml_config/schema.hpp index 380f99f4cf5a..fb0bb2470876 100644 --- a/core/include/userver/yaml_config/schema.hpp +++ b/universal/include/userver/yaml_config/schema.hpp @@ -47,6 +47,8 @@ class SchemaPtr final { formats::yaml::Value Serialize(const SchemaPtr& schema, formats::serialize::To); +/// @ingroup userver_universal +/// /// @brief JSON Schema-like type definition /// /// @see @ref static-configs-validation "Static configs validation" diff --git a/core/include/userver/yaml_config/yaml_config.hpp b/universal/include/userver/yaml_config/yaml_config.hpp similarity index 99% rename from core/include/userver/yaml_config/yaml_config.hpp rename to universal/include/userver/yaml_config/yaml_config.hpp index e496848d2d16..81d6626842aa 100644 --- a/core/include/userver/yaml_config/yaml_config.hpp +++ b/universal/include/userver/yaml_config/yaml_config.hpp @@ -23,7 +23,7 @@ namespace yaml_config { using Exception = formats::yaml::Exception; using ParseException = formats::yaml::ParseException; -/// @ingroup userver_formats +/// @ingroup userver_formats userver_universal /// /// @brief Datatype that represents YAML with substituted variables /// diff --git a/core/testing/src/utest/assert_macros.cpp b/universal/src/utest/assert_macros.cpp similarity index 96% rename from core/testing/src/utest/assert_macros.cpp rename to universal/src/utest/assert_macros.cpp index b9f1c1a8c839..601e5b76e98e 100644 --- a/core/testing/src/utest/assert_macros.cpp +++ b/universal/src/utest/assert_macros.cpp @@ -1,4 +1,4 @@ -#include +#include #include @@ -7,6 +7,11 @@ #include #include +#ifdef EXPECT_EQ +#error gtest.h headers should not be included to avoid userver-universal \ + dependency on testing library +#endif + USERVER_NAMESPACE_BEGIN namespace utest::impl { diff --git a/core/testing/src/utest/assert_macros_test.cpp b/universal/src/utest/assert_macros_test.cpp similarity index 100% rename from core/testing/src/utest/assert_macros_test.cpp rename to universal/src/utest/assert_macros_test.cpp diff --git a/core/src/yaml_config/impl/validate_static_config.cpp b/universal/src/yaml_config/impl/validate_static_config.cpp similarity index 100% rename from core/src/yaml_config/impl/validate_static_config.cpp rename to universal/src/yaml_config/impl/validate_static_config.cpp diff --git a/core/src/yaml_config/impl/validate_static_config_test.cpp b/universal/src/yaml_config/impl/validate_static_config_test.cpp similarity index 99% rename from core/src/yaml_config/impl/validate_static_config_test.cpp rename to universal/src/yaml_config/impl/validate_static_config_test.cpp index 6439796c7e9a..6fdd819d37fe 100644 --- a/core/src/yaml_config/impl/validate_static_config_test.cpp +++ b/universal/src/yaml_config/impl/validate_static_config_test.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include USERVER_NAMESPACE_BEGIN diff --git a/core/src/yaml_config/iterator.cpp b/universal/src/yaml_config/iterator.cpp similarity index 100% rename from core/src/yaml_config/iterator.cpp rename to universal/src/yaml_config/iterator.cpp diff --git a/core/src/yaml_config/merge_schemas.cpp b/universal/src/yaml_config/merge_schemas.cpp similarity index 100% rename from core/src/yaml_config/merge_schemas.cpp rename to universal/src/yaml_config/merge_schemas.cpp diff --git a/core/src/yaml_config/merge_schemas_test.cpp b/universal/src/yaml_config/merge_schemas_test.cpp similarity index 98% rename from core/src/yaml_config/merge_schemas_test.cpp rename to universal/src/yaml_config/merge_schemas_test.cpp index 1ba5ac5fb2fb..63bf6fba8ba5 100644 --- a/core/src/yaml_config/merge_schemas_test.cpp +++ b/universal/src/yaml_config/merge_schemas_test.cpp @@ -2,7 +2,7 @@ #include -#include +#include USERVER_NAMESPACE_BEGIN diff --git a/core/src/yaml_config/schema.cpp b/universal/src/yaml_config/schema.cpp similarity index 100% rename from core/src/yaml_config/schema.cpp rename to universal/src/yaml_config/schema.cpp diff --git a/core/src/yaml_config/yaml_config.cpp b/universal/src/yaml_config/yaml_config.cpp similarity index 100% rename from core/src/yaml_config/yaml_config.cpp rename to universal/src/yaml_config/yaml_config.cpp diff --git a/core/src/yaml_config/yaml_config_test.cpp b/universal/src/yaml_config/yaml_config_test.cpp similarity index 100% rename from core/src/yaml_config/yaml_config_test.cpp rename to universal/src/yaml_config/yaml_config_test.cpp