8000 Enhance Repository.Lookup() test coverage · kanglingv/libgit2sharp@fc2a47c · GitHub
[go: up one dir, main page]

Skip to content

Commit fc2a47c

Browse files
committed
Enhance Repository.Lookup() test coverage
1 parent 23f97d9 commit fc2a47c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

LibGit2Sharp.Tests/RepositoryFixture.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,20 @@ public void LookingUpWithATooShortShaThrows()
493493< 8000 code class="diff-text syntax-highlighted-line">
}
494494
}
495495

496+
[Fact]
497+
public void LookingUpByAWrongRevParseExpressionThrows()
498+
{
499+
string path = SandboxBareTestRepo();
500+
using (var repo = new Repository(path))
501+
{
502+
Assert.Throws<InvalidSpecificationException>(() => repo.Lookup("tags/point_to_blob^{tree}"));
503+
Assert.Throws<InvalidSpecificationException>(() => repo.Lookup("tags/point_to_blob^{commit}"));
504+
Assert.Throws<InvalidSpecificationException>(() => repo.Lookup<Commit>("tags/point_to_blob^{commit}"));
505+
Assert.Throws<InvalidSpecificationException>(() => repo.Lookup("master^{tree}^{blob}"));
506+
Assert.Throws<InvalidSpecificationException>(() => repo.Lookup<Blob>("master^{blob}"));
507+
}
508+
}
509+
496510
[Fact]
497511
public void LookingUpAGitLinkThrows()
498512
{

0 commit comments

Comments
 (0)
0