diff options
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/api/TagCommandTest.java')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/api/TagCommandTest.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/TagCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/TagCommandTest.java index 1db0381d0b..1e8f7fde01 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/TagCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/TagCommandTest.java @@ -197,4 +197,40 @@ public class TagCommandTest extends RepositoryTestCase { assertEquals(0, deleted.size()); } + @Test + public void testShouldNotBlowUpIfThereAreNoTagsInRepository() + throws Exception { + Git git = new Git(db); + git.add().addFilepattern("*").call(); + git.commit().setMessage("initial commit").call(); + List<RevTag> list = git.tagList().call(); + assertEquals(0, list.size()); + } + + @Test + public void testShouldNotBlowUpIfThereAreNoCommitsInRepository() + throws Exception { + Git git = new Git(db); + List<RevTag> list = git.tagList().call(); + assertEquals(0, list.size()); + } + + @Test + public void testListAllTagsInRepositoryInOrder() throws Exception { + Git git = new Git(db); + git.add().addFilepattern("*").call(); + git.commit().setMessage("initial commit").call(); + + git.tag().setName("v3").call(); + git.tag().setName("v2").call(); + git.tag().setName("v10").call(); + + List<RevTag> list = git.tagList().call(); + + assertEquals(3, list.size()); + assertEquals("v10", list.get(0).getTagName()); + assertEquals("v2", list.get(1).getTagName()); + assertEquals("v3", list.get(2).getTagName()); + } + } |