eden/fs/model/git/test/GitTreeTest.cpp
// Test using GitTreeSerializer after moving it
Test using GitTreeSerializer after moving it
Test using GitTreeSerializer after moving it
TEST(GitTree, moveSerializer) {
  GitTreeSerializer serializer2;
  {
    GitTreeSerializer serializer1;
    serializer1.addEntry(TreeEntry(
        Hash("3b18e512dba79e4c8300dd08aeb37f8e728b8dad"),
        "README.md",
        TreeEntryType::REGULAR_FILE));
    serializer2 = std::move(serializer1);
  }
  serializer2.addEntry(TreeEntry(
      Hash("43b71c903ff52b9885bd36f3866324ef60e27b9b"),
      "eden",
      TreeEntryType::TREE));
  auto buf = serializer2.finalize();
  auto treeHash = Hash::sha1(buf);
  EXPECT_EQ(Hash("daa1785514e56d64549d8169ec7dc26803d2f7df"), treeHash);
}
TEST ( GitTree , moveSerializer ) { GitTreeSerializer serializer2 ; { GitTreeSerializer serializer1 ; serializer1 . addEntry ( TreeEntry ( Hash ( " " ) , " " , TreeEntryType :: REGULAR_FILE ) ) ; serializer2 = std :: move ( serializer1 ) ; } serializer2 . addEntry ( TreeEntry ( Hash ( " " ) , " " , TreeEntryType :: TREE ) ) ; auto buf = serializer2 . finalize ( ) ; auto treeHash = Hash :: sha1 ( buf ) ; EXPECT_EQ ( Hash ( " " ) , treeHash ) ; }
Test using GitTreeSerializer after moving it
Test using GitTreeSerializer after moving it
// Make sure the tree hash is what we expect