From 6a7087f175ca7235fde533d05ddc7dc64b91504b Mon Sep 17 00:00:00 2001 From: Aaron Fiore Date: Tue, 23 Dec 2025 11:53:49 -0800 Subject: [PATCH] container: root: test: unit: common: PluggableSpace: add case for conversions --- container/src/root/test/unit/utility.hh | 26 +++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/container/src/root/test/unit/utility.hh b/container/src/root/test/unit/utility.hh index ce9f42e..52622e5 100644 --- a/container/src/root/test/unit/utility.hh +++ b/container/src/root/test/unit/utility.hh @@ -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);