Extend test cases for rename with overwrite

This commit is contained in:
Sebastian Messmer 2016-04-29 11:07:47 -07:00
parent 33644af64d
commit 4829f4bcec

View File

@ -115,7 +115,7 @@ public:
} }
} }
void Test_Overwrite() { void Test_Overwrite_InSameDir() {
auto node = this->CreateNode("/oldname"); auto node = this->CreateNode("/oldname");
this->CreateNode("/newname"); this->CreateNode("/newname");
node->rename("/newname"); node->rename("/newname");
@ -123,6 +123,16 @@ public:
EXPECT_NE(boost::none, this->device->Load("/newname")); EXPECT_NE(boost::none, this->device->Load("/newname"));
} }
void Test_Overwrite_InDifferentDir() {
this->CreateDir("/parent1");
this->CreateDir("/parent2");
auto node = this->CreateNode("/parent1/oldname");
this->CreateNode("/parent2/newname");
node->rename("/parent2/newname");
EXPECT_EQ(boost::none, this->device->Load("/parent1/oldname"));
EXPECT_NE(boost::none, this->device->Load("/parent2/newname"));
}
void Test_Overwrite_DoesntHaveSameEntryTwice() { void Test_Overwrite_DoesntHaveSameEntryTwice() {
auto node = this->CreateNode("/oldname"); auto node = this->CreateNode("/oldname");
this->CreateNode("/newname"); this->CreateNode("/newname");
@ -201,7 +211,8 @@ REGISTER_NODE_TEST_CASE(FsppNodeTest_Rename,
NestedToNested_NewName, NestedToNested_NewName,
ToItself, ToItself,
RootDir, RootDir,
Overwrite, Overwrite_InSameDir,
Overwrite_InDifferentDir,
Overwrite_DoesntHaveSameEntryTwice, Overwrite_DoesntHaveSameEntryTwice,
Overwrite_DirWithFile_InSameDir, Overwrite_DirWithFile_InSameDir,
Overwrite_DirWithFile_InDifferentDir, Overwrite_DirWithFile_InDifferentDir,