container: root: test: unit: common: PluggableSpace: add case for conversions

This commit is contained in:
2025-12-23 11:53:49 -08:00
parent ce12412d10
commit 6a7087f175

View File

@@ -670,11 +670,10 @@ struct PluggableSpace : public ::testing::Test,
struct Space : public ::dfi::common::PluggableSpace struct Space : public ::dfi::common::PluggableSpace
{ {
using space = ::dfi::tests::unit::PluggableSpace;
explicit Space(const std::string_view outer, const std::string_view inner) explicit Space(const std::string_view outer, const std::string_view inner)
: ::dfi::common::PluggableSpace( : ::dfi::common::PluggableSpace(
::dfi::common::type::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); 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) TEST_F(PluggableSpace, Booleans)
{ {
ASSERT_EQ(m_space.has_outer(), true); ASSERT_EQ(m_space.has_outer(), true);