summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java
index 5c19af3004..ac37c73ca8 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java
@@ -74,6 +74,7 @@ import org.junit.Test;
public class ReftableTest {
private static final String MASTER = "refs/heads/master";
+ private static final String NEXT = "refs/heads/next";
private static final String V1_0 = "refs/tags/v1.0";
private Stats stats;
@@ -273,6 +274,41 @@ public class ReftableTest {
}
}
+ @Test
+ public void namespaceNotFound() throws IOException {
+ Ref exp = ref(MASTER, 1);
+ ReftableReader t = read(write(exp));
+ try (RefCursor rc = t.seekRef("refs/changes/")) {
+ assertFalse(rc.next());
+ }
+ try (RefCursor rc = t.seekRef("refs/tags/")) {
+ assertFalse(rc.next());
+ }
+ }
+
+ @Test
+ public void namespaceHeads() throws IOException {
+ Ref master = ref(MASTER, 1);
+ Ref next = ref(NEXT, 2);
+ Ref v1 = tag(V1_0, 3, 4);
+
+ ReftableReader t = read(write(master, next, v1));
+ try (RefCursor rc = t.seekRef("refs/tags/")) {
+ assertTrue(rc.next());
+ assertEquals(V1_0, rc.getRef().getName());
+ assertFalse(rc.next());
+ }
+ try (RefCursor rc = t.seekRef("refs/heads/")) {
+ assertTrue(rc.next());
+ assertEquals(MASTER, rc.getRef().getName());
+
+ assertTrue(rc.next());
+ assertEquals(NEXT, rc.getRef().getName());
+
+ assertFalse(rc.next());
+ }
+ }
+
@SuppressWarnings("boxing")
@Test
public void indexScan() throws IOException {