diff options
| author | William A. Kennington III <wak@google.com> | 2018-11-13 14:28:36 -0800 |
|---|---|---|
| committer | William A. Kennington III <wak@google.com> | 2019-03-29 14:18:57 -0700 |
| commit | e04cb03ba08f61f9d07e61764fee545c55f62f35 (patch) | |
| tree | ba8268d32a2241599e00337e64e8447a90b9dd1c /test/source/base.cpp | |
| parent | 127f3214693e4b6af2245a0de9845b4184747fb4 (diff) | |
| download | sdeventplus-e04cb03ba08f61f9d07e61764fee545c55f62f35.tar.gz sdeventplus-e04cb03ba08f61f9d07e61764fee545c55f62f35.zip | |
internal/sdref: Remove in favor of stdplus/handle
We no longer need to roll our own managed handle type now that stdplus
implements a generic one.
Tested:
Built and run through unit tests.
Change-Id: Id34cd8d3ffacf7901d49cac335fa93f744f0e310
Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'test/source/base.cpp')
| -rw-r--r-- | test/source/base.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/test/source/base.cpp b/test/source/base.cpp index 75a6dde..2139dd0 100644 --- a/test/source/base.cpp +++ b/test/source/base.cpp @@ -2,6 +2,7 @@ #include <gmock/gmock.h> #include <gtest/gtest.h> #include <memory> +#include <optional> #include <sdeventplus/event.hpp> #include <sdeventplus/exception.hpp> #include <sdeventplus/internal/sdevent.hpp> @@ -93,8 +94,8 @@ class BaseTest : public testing::Test .WillOnce(DoAll(SaveArg<1>(&userdata), Return(nullptr))); BaseImpl mover(std::move(other)); EXPECT_EQ(&mover, userdata); - EXPECT_EQ(nullptr, other.get()); - EXPECT_EQ(nullptr, other.get_event().get()); + EXPECT_THROW(other.get(), std::bad_optional_access); + EXPECT_THROW(other.get_event().get(), std::bad_optional_access); EXPECT_FALSE(other.get_prepare()); expect_base_destruct(mover.get_event(), mover.get()); @@ -160,8 +161,8 @@ TEST_F(BaseTest, MoveConstruct) .WillOnce(DoAll(SaveArg<1>(&userdata), Return(nullptr))); BaseImpl source2(std::move(*source1)); EXPECT_EQ(&source2, userdata); - EXPECT_EQ(nullptr, source1->get()); - EXPECT_EQ(nullptr, source1->get_event().get()); + EXPECT_THROW(source1->get(), std::bad_optional_access); + EXPECT_THROW(source1->get_event().get(), std::bad_optional_access); EXPECT_FALSE(source1->get_prepare()); EXPECT_EQ(expected_source, source2.get()); EXPECT_EQ(expected_event, source2.get_event().get()); @@ -199,8 +200,8 @@ TEST_F(BaseTest, MoveAssignEmpty) *source2 = std::move(*source1); EXPECT_EQ(source2.get(), userdata); } - EXPECT_EQ(nullptr, source1->get()); - EXPECT_EQ(nullptr, source1->get_event().get()); + EXPECT_THROW(source1->get(), std::bad_optional_access); + EXPECT_THROW(source1->get_event().get(), std::bad_optional_access); EXPECT_FALSE(source1->get_prepare()); EXPECT_EQ(expected_source, source2->get()); EXPECT_EQ(expected_event, source2->get_event().get()); @@ -232,8 +233,8 @@ TEST_F(BaseTest, MoveAssignExisting) *source2 = std::move(*source1); EXPECT_EQ(source2.get(), userdata); } - EXPECT_EQ(nullptr, source1->get()); - EXPECT_EQ(nullptr, source1->get_event().get()); + EXPECT_THROW(source1->get(), std::bad_optional_access); + EXPECT_THROW(source1->get_event().get(), std::bad_optional_access); EXPECT_FALSE(source1->get_prepare()); EXPECT_EQ(expected_source, source2->get()); EXPECT_EQ(expected_event, source2->get_event().get()); |

