forked from EvergreenCrypto/docker-finance
container: root: test: unit: common: PluggableSpace: add case for conversions
This commit is contained in:
@@ -670,11 +670,10 @@ struct PluggableSpace : public ::testing::Test,
|
||||
|
||||
struct Space : public ::dfi::common::PluggableSpace
|
||||
{
|
||||
using space = ::dfi::tests::unit::PluggableSpace;
|
||||
explicit Space(const std::string_view outer, const std::string_view inner)
|
||||
: ::dfi::common::PluggableSpace(
|
||||
::dfi::common::type::PluggableSpace{
|
||||
{std::string{space::kOuter}, std::string{space::kInner}}})
|
||||
{std::string{outer}, std::string{inner}}})
|
||||
{
|
||||
}
|
||||
|
||||
@@ -726,6 +725,29 @@ TEST_F(PluggableSpace, Mutators)
|
||||
ASSERT_EQ(m_space.inner(), kFour);
|
||||
}
|
||||
|
||||
TEST_F(PluggableSpace, Conversions)
|
||||
{
|
||||
ASSERT_NO_THROW(Space space("", ""));
|
||||
ASSERT_NO_THROW(Space space("hi/hey", "there/now"));
|
||||
ASSERT_THROW(Space space("hi hey", "there now"), common::type::RuntimeError);
|
||||
ASSERT_THROW(Space space("hi@hey", "there@now"), common::type::RuntimeError);
|
||||
|
||||
Space space("hi/hey", "there/now");
|
||||
ASSERT_NO_THROW(space().outer("hi hey").inner("there now"));
|
||||
ASSERT_THROW(space.parse(), common::type::RuntimeError);
|
||||
ASSERT_NO_THROW(space().outer("hi@hey").inner("there@now"));
|
||||
ASSERT_THROW(space.parse(), common::type::RuntimeError);
|
||||
|
||||
space = Space{"hi/hey", "there/now"};
|
||||
ASSERT_EQ(space.outer(), "hi::hey");
|
||||
ASSERT_EQ(space.inner(), "there::now");
|
||||
|
||||
ASSERT_NO_THROW(space().outer("hi-hey").inner("there-now"));
|
||||
ASSERT_NO_THROW(space.parse());
|
||||
ASSERT_EQ(space.outer(), "hi_hey");
|
||||
ASSERT_EQ(space.inner(), "there_now");
|
||||
}
|
||||
|
||||
TEST_F(PluggableSpace, Booleans)
|
||||
{
|
||||
ASSERT_EQ(m_space.has_outer(), true);
|
||||
|
||||
Reference in New Issue
Block a user