Skip to content

Commit

Permalink
diff(src,dst) should generate empty patch if src == dst
Browse files Browse the repository at this point in the history
Reviewed By: pranavtbhat

Differential Revision: D68864929

fbshipit-source-id: d2dfee5952e65c84c1ce6be852a249f0a416d484
  • Loading branch information
TJ Yin authored and facebook-github-bot committed Jan 30, 2025
1 parent 1b400c6 commit 4ea8f4a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions thrift/lib/cpp2/patch/test/DynamicPatchTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ void testOneWay(T src, T dst) {
auto other =
detail::createPatchFromObject<PatchType>(badge, patch.toObject());
EXPECT_EQ(other.toObject(), patch.toObject());
EXPECT_EQ(patch.empty(), src == dst);
}

TEST(DynamicPatchTest, Binary) {
Expand Down Expand Up @@ -162,6 +163,7 @@ void testMapAndObject(
auto patch = DiffVisitorBase{}.diff(objSrc, objDst);
applyPatch(patch.toObject(), objSrc);
EXPECT_EQ(objSrc, objDst);
EXPECT_EQ(patch.empty(), src == dst);

if (mightBeUnion) {
EXPECT_TRUE(patch.holds_alternative<DynamicUnknownPatch>(badge));
Expand Down

0 comments on commit 4ea8f4a

Please sign in to comment.