21 #include <unity/scopes/Version.h> 23 #include <unity/scopes/testing/MockRegistry.h> 25 #pragma GCC diagnostic push 26 #pragma GCC diagnostic ignored "-Wctor-dtor-privacy" 27 #include <gtest/gtest.h> 28 #pragma GCC diagnostic pop 45 template<
typename Scope>
48 inline static const char* name()
53 inline static std::shared_ptr<Scope> construct()
55 return std::make_shared<Scope>();
59 class TypedScopeFixtureHelper
61 static void set_scope_directory(std::shared_ptr<ScopeBase>
const& scope, std::string
const& path);
62 static void set_cache_directory(std::shared_ptr<ScopeBase>
const& scope, std::string
const& path);
63 static void set_app_directory(std::shared_ptr<ScopeBase>
const& scope, std::string
const& path);
64 static void set_tmp_directory(std::shared_ptr<ScopeBase>
const& scope, std::string
const& path);
65 static void set_registry(std::shared_ptr<ScopeBase>
const& scope,
RegistryProxy const& r);
67 template<
typename Scope>
68 friend class TypedScopeFixture;
79 template<
typename Scope>
86 , scope(ScopeTraits<Scope>::construct())
88 TypedScopeFixtureHelper::set_registry(scope, registry_proxy);
89 TypedScopeFixtureHelper::set_scope_directory(scope,
"/tmp");
90 TypedScopeFixtureHelper::set_app_directory(scope,
"/tmp");
95 ASSERT_NO_THROW(scope->start(ScopeTraits<Scope>::name()));
96 ASSERT_NO_THROW(scope->run());
99 void set_scope_directory(std::string
const& path)
101 TypedScopeFixtureHelper::set_scope_directory(scope, path);
104 void set_cache_directory(std::string
const& path)
106 TypedScopeFixtureHelper::set_cache_directory(scope, path);
109 void set_app_directory(std::string
const& path)
111 TypedScopeFixtureHelper::set_app_directory(scope, path);
114 void set_tmp_directory(std::string
const& path)
116 TypedScopeFixtureHelper::set_tmp_directory(scope, path);
119 static void set_registry(std::shared_ptr<ScopeBase>
const& scope,
RegistryProxy const& r)
121 TypedScopeFixtureHelper::set_registry(scope, r);
126 EXPECT_NO_THROW(scope->stop());
130 unity::scopes::testing::MockRegistry registry;
132 std::shared_ptr<Scope> scope;
Fixture for testing scope testing.
Definition: TypedScopeFixture.h:80
Definition: OnlineAccountClient.h:39
Top-level namespace for all things Unity-related.
Definition: Version.h:49
White pages service for available scopes.
Definition: Registry.h:51
std::shared_ptr< Registry > RegistryProxy
Convenience type definition.
Definition: RegistryProxyFwd.h:33