8000 Enhance SubmoduleUpdate tests · GiTechLab/libgit2sharp@00f30d8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 00f30d8

Browse files
committed
Enhance SubmoduleUpdate tests
Verify that checkout callbacks are called as part of SubmoduleUpdate.
1 parent 554b55c commit 00f30d8

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

LibGit2Sharp.Tests/SubmoduleFixture.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,24 @@ public void CanUpdateSubmodule()
208208
Assert.NotNull(submodule);
209209
Assert.True(submodule.RetrieveStatus().HasFlag(SubmoduleStatus.WorkDirUninitialized));
210210

211+
bool checkoutProgressCalled = false;
212+
bool checkoutNotifyCalled = false;
213+
bool updateTipsCalled = false;
214+
var options = new SubmoduleUpdateOptions()
215+
{
216+
OnCheckoutProgress = (x, y, z) => checkoutProgressCalled = true,
217+
OnCheckoutNotify = (x, y) => { checkoutNotifyCalled = true; return true; },
218+
CheckoutNotifyFlags = CheckoutNotifyFlags.Updated,
219+
OnUpdateTips = (x, y, z) => { updateTipsCalled = true; return true; },
220+
};
221+
211222
repo.Submodules.Init(submodule.Name, false);
212-
repo.Submodules.Update(submodule.Name, new SubmoduleUpdateOptions());
223+
repo.Submodules.Update(submodule.Name, options);
213224

214225
Assert.True(submodule.RetrieveStatus().HasFlag(SubmoduleStatus.InWorkDir));
226+
Assert.True(checkoutProgressCalled);
227+
Assert.True(checkoutNotifyCalled);
228+
Assert.True(updateTipsCalled);
215229
Assert.Equal((ObjectId)"480095882d281ed676fe5b863569520e54a7d5c0", submodule.HeadCommitId);
216230
Assert.Equal((ObjectId)"480095882d281ed676fe5b863569520e54a7d5c0", submodule.IndexCommitId);
217231
Assert.Equal((ObjectId)"480095882d281ed676fe5b863569520e54a7d5c0", submodule.WorkDirCommitId);

0 commit comments

Comments
 (0)
0