Adapt to new dynamic_pointer_move

This commit is contained in:
Sebastian Meßmer 2015-06-18 19:34:24 +02:00
parent 5039205cd2
commit 31cd0eb9e9
2 changed files with 3 additions and 11 deletions

View File

@ -50,7 +50,8 @@ optional<unique_ref<Blob>> BlobStoreOnBlocks::load(const Key &key) {
void BlobStoreOnBlocks::remove(unique_ref<Blob> blob) { void BlobStoreOnBlocks::remove(unique_ref<Blob> blob) {
auto _blob = dynamic_pointer_move<BlobOnBlocks>(blob); auto _blob = dynamic_pointer_move<BlobOnBlocks>(blob);
_dataTreeStore->remove(_blob->releaseTree()); assert(_blob != none);
_dataTreeStore->remove((*_blob)->releaseTree());
} }
} }

View File

@ -1,20 +1,11 @@
#include "testutils/BlobStoreTest.h" #include "testutils/BlobStoreTest.h"
#include <boost/optional/optional_io.hpp> #include <messmer/cpp-utils/unique_ref_boost_optional_gtest_workaround.h>
using blockstore::Key; using blockstore::Key;
using cpputils::unique_ref; using cpputils::unique_ref;
using blobstore::Blob; using blobstore::Blob;
using boost::none; using boost::none;
//gtest/boost::optional workaround for working with optional<unique_ref<T>>
namespace boost {
std::ostream& operator<<(std::ostream& out, const unique_ref<Blob> &ref) {
out << "[" << ref->key().ToString() << "]" << ref.get();
return out;
}
}
TEST_F(BlobStoreTest, LoadNonexistingKeyOnEmptyBlobstore) { TEST_F(BlobStoreTest, LoadNonexistingKeyOnEmptyBlobstore) {
const blockstore::Key key = blockstore::Key::FromString("1491BB4932A389EE14BC7090AC772972"); const blockstore::Key key = blockstore::Key::FromString("1491BB4932A389EE14BC7090AC772972");
EXPECT_EQ(none, blobStore->load(key)); EXPECT_EQ(none, blobStore->load(key));