From 3e88caaa9911f8708a11fc0f2f352b92ff715015 Mon Sep 17 00:00:00 2001 From: Aaron Fiore Date: Thu, 8 Jan 2026 14:32:31 -0800 Subject: [PATCH] container: root: test: unit: utility: add PluggableSpace entrypoint --- container/src/root/test/unit/utility.hh | 66 ++++++++++++++++--------- 1 file changed, 43 insertions(+), 23 deletions(-) diff --git a/container/src/root/test/unit/utility.hh b/container/src/root/test/unit/utility.hh index 52622e5..2ea45fa 100644 --- a/container/src/root/test/unit/utility.hh +++ b/container/src/root/test/unit/utility.hh @@ -1,6 +1,6 @@ // docker-finance | modern accounting for the power-user // -// Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC) +// Copyright (C) 2021-2026 Aaron Fiore (Founder, Evergreen Crypto LLC) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -663,17 +663,21 @@ TEST_F(PluggablePath, Mutators) struct PluggableSpace : public ::testing::Test, public ::dfi::tests::CommonFixture { - PluggableSpace() : m_space(kOuter, kInner) {} + PluggableSpace() : m_space(kOuter, kInner, kEntry) {} static constexpr std::string_view kOuter{"outer::space"}; static constexpr std::string_view kInner{"inner::space"}; + static constexpr std::string_view kEntry{"class_C"}; struct Space : public ::dfi::common::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, + const std::string_view entry) : ::dfi::common::PluggableSpace( ::dfi::common::type::PluggableSpace{ - {std::string{outer}, std::string{inner}}}) + {std::string{outer}, std::string{inner}, std::string{entry}}}) { } @@ -695,68 +699,84 @@ TEST_F(PluggableSpace, Accessors) { ASSERT_EQ(m_space.outer(), kOuter); ASSERT_EQ(m_space.inner(), kInner); + ASSERT_EQ(m_space.entry(), kEntry); ASSERT_EQ(m_space().outer(), kOuter); ASSERT_EQ(m_space().inner(), kInner); + ASSERT_EQ(m_space().entry(), kEntry); } TEST_F(PluggableSpace, Mutators) { const std::string kOne{std::string{kOuter} + std::string{"::one"}}; const std::string kTwo{std::string{kInner} + std::string{"::two"}}; + const std::string kThree{std::string{kInner} + std::string{"_"}}; - ASSERT_NO_THROW(m_space().outer(kOne).inner(kTwo)); + ASSERT_NO_THROW(m_space().outer(kOne).inner(kTwo).entry(kThree)); ASSERT_EQ(m_space().outer(), kOne); ASSERT_EQ(m_space().inner(), kTwo); + ASSERT_EQ(m_space().entry(), kThree); ASSERT_EQ(m_space.outer(), kOne); ASSERT_EQ(m_space.inner(), kTwo); + ASSERT_EQ(m_space.entry(), kThree); - const std::string kThree{std::string{kOuter} + std::string{"::three"}}; - const std::string kFour{std::string{kInner} + std::string{"::four"}}; + const std::string kFour{std::string{kOuter} + std::string{"::four"}}; + const std::string kFive{std::string{kInner} + std::string{"::five"}}; + const std::string kSix{std::string{kInner} + std::string{"__"}}; - ASSERT_NO_THROW(m_space().outer(kThree).inner(kFour)); + ASSERT_NO_THROW(m_space().outer(kFour).inner(kFive).entry(kSix)); - ASSERT_EQ(m_space().outer(), kThree); - ASSERT_EQ(m_space().inner(), kFour); + ASSERT_EQ(m_space().outer(), kFour); + ASSERT_EQ(m_space().inner(), kFive); + ASSERT_EQ(m_space().entry(), kSix); - ASSERT_EQ(m_space.outer(), kThree); - ASSERT_EQ(m_space.inner(), kFour); + ASSERT_EQ(m_space.outer(), kFour); + ASSERT_EQ(m_space.inner(), kFive); + ASSERT_EQ(m_space.entry(), kSix); } 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); + ASSERT_NO_THROW(Space space("", "", "")); + ASSERT_NO_THROW(Space space("hi/hey", "there/now", "dot.ext")); + ASSERT_THROW( + Space space("hi hey", "there now", "dot ext"), + common::type::RuntimeError); + ASSERT_THROW( + Space space("hi@hey", "there@now", "dot@ext"), + common::type::RuntimeError); - Space space("hi/hey", "there/now"); - ASSERT_NO_THROW(space().outer("hi hey").inner("there now")); + Space space("hi/hey", "there/now", "dot.ext"); + ASSERT_NO_THROW(space().outer("hi hey").inner("there now").entry("dot ext")); ASSERT_THROW(space.parse(), common::type::RuntimeError); - ASSERT_NO_THROW(space().outer("hi@hey").inner("there@now")); + ASSERT_NO_THROW(space().outer("hi@hey").inner("there@now").entry("dot ext")); ASSERT_THROW(space.parse(), common::type::RuntimeError); - space = Space{"hi/hey", "there/now"}; + space = Space{"hi/hey", "there/now", "dot.ext"}; ASSERT_EQ(space.outer(), "hi::hey"); ASSERT_EQ(space.inner(), "there::now"); + ASSERT_EQ(space.entry(), "dot_ext"); - ASSERT_NO_THROW(space().outer("hi-hey").inner("there-now")); + ASSERT_NO_THROW(space().outer("hi-hey").inner("there-now").entry("dot-ext")); ASSERT_NO_THROW(space.parse()); ASSERT_EQ(space.outer(), "hi_hey"); ASSERT_EQ(space.inner(), "there_now"); + ASSERT_EQ(space.entry(), "dot_ext"); } TEST_F(PluggableSpace, Booleans) { ASSERT_EQ(m_space.has_outer(), true); ASSERT_EQ(m_space.has_inner(), true); + ASSERT_EQ(m_space.has_entry(), true); - ASSERT_NO_THROW(m_space().outer("").inner("")); + ASSERT_NO_THROW(m_space().outer("").inner("").entry("")); ASSERT_EQ(m_space.has_outer(), false); ASSERT_EQ(m_space.has_inner(), false); + ASSERT_EQ(m_space.has_entry(), false); } //! \brief PluggableArgs fixture @@ -1057,7 +1077,7 @@ TEST_F(PluginCommands, LoaderNPI) ::dfi::common::type::Pluggable type{ t_path{kValidFile}, - t_space{"example"}, // inner + t_space{"example" /* inner */, "example_cc" /* class */}, t_args{kValidArg + " e.example1();", kValidArg + " e.example2();"}}; plugin::common::Plugin plugin{type};