Browse Source

DirCacheIteratorTest: Use newInCore instead of disk

Avoid the dependency on the local filesystem by using only an in-core
DirCache instance.  Each test case builds up the index from scratch
anyway through a DirCacheBuilder.

Change-Id: I5decf6bffc3ed35bf1d3e4ad5cc095891c80b772
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
stable-0.11
Shawn O. Pearce 14 years ago
parent
commit
edeea800a6
  1. 16
      org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheIteratorTest.java

16
org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheIteratorTest.java vendored

@ -52,7 +52,7 @@ import org.eclipse.jgit.treewalk.filter.PathFilterGroup;
public class DirCacheIteratorTest extends RepositoryTestCase { public class DirCacheIteratorTest extends RepositoryTestCase {
public void testEmptyTree_NoTreeWalk() throws Exception { public void testEmptyTree_NoTreeWalk() throws Exception {
final DirCache dc = db.readDirCache(); final DirCache dc = DirCache.newInCore();
assertEquals(0, dc.getEntryCount()); assertEquals(0, dc.getEntryCount());
final DirCacheIterator i = new DirCacheIterator(dc); final DirCacheIterator i = new DirCacheIterator(dc);
@ -60,7 +60,7 @@ public class DirCacheIteratorTest extends RepositoryTestCase {
} }
public void testEmptyTree_WithTreeWalk() throws Exception { public void testEmptyTree_WithTreeWalk() throws Exception {
final DirCache dc = db.readDirCache(); final DirCache dc = DirCache.newInCore();
assertEquals(0, dc.getEntryCount()); assertEquals(0, dc.getEntryCount());
final TreeWalk tw = new TreeWalk(db); final TreeWalk tw = new TreeWalk(db);
@ -69,7 +69,7 @@ public class DirCacheIteratorTest extends RepositoryTestCase {
} }
public void testNoSubtree_NoTreeWalk() throws Exception { public void testNoSubtree_NoTreeWalk() throws Exception {
final DirCache dc = db.readDirCache(); final DirCache dc = DirCache.newInCore();
final String[] paths = { "a.", "a0b" }; final String[] paths = { "a.", "a0b" };
final DirCacheEntry[] ents = new DirCacheEntry[paths.length]; final DirCacheEntry[] ents = new DirCacheEntry[paths.length];
@ -94,7 +94,7 @@ public class DirCacheIteratorTest extends RepositoryTestCase {
} }
public void testNoSubtree_WithTreeWalk() throws Exception { public void testNoSubtree_WithTreeWalk() throws Exception {
final DirCache dc = db.readDirCache(); final DirCache dc = DirCache.newInCore();
final String[] paths = { "a.", "a0b" }; final String[] paths = { "a.", "a0b" };
final FileMode[] modes = { FileMode.EXECUTABLE_FILE, FileMode.GITLINK }; final FileMode[] modes = { FileMode.EXECUTABLE_FILE, FileMode.GITLINK };
@ -126,7 +126,7 @@ public class DirCacheIteratorTest extends RepositoryTestCase {
} }
public void testSingleSubtree_NoRecursion() throws Exception { public void testSingleSubtree_NoRecursion() throws Exception {
final DirCache dc = db.readDirCache(); final DirCache dc = DirCache.newInCore();
final String[] paths = { "a.", "a/b", "a/c", "a/d", "a0b" }; final String[] paths = { "a.", "a/b", "a/c", "a/d", "a0b" };
final DirCacheEntry[] ents = new DirCacheEntry[paths.length]; final DirCacheEntry[] ents = new DirCacheEntry[paths.length];
@ -169,7 +169,7 @@ public class DirCacheIteratorTest extends RepositoryTestCase {
} }
public void testSingleSubtree_Recursive() throws Exception { public void testSingleSubtree_Recursive() throws Exception {
final DirCache dc = db.readDirCache(); final DirCache dc = DirCache.newInCore();
final FileMode mode = FileMode.REGULAR_FILE; final FileMode mode = FileMode.REGULAR_FILE;
final String[] paths = { "a.", "a/b", "a/c", "a/d", "a0b" }; final String[] paths = { "a.", "a/b", "a/c", "a/d", "a0b" };
@ -203,7 +203,7 @@ public class DirCacheIteratorTest extends RepositoryTestCase {
} }
public void testTwoLevelSubtree_Recursive() throws Exception { public void testTwoLevelSubtree_Recursive() throws Exception {
final DirCache dc = db.readDirCache(); final DirCache dc = DirCache.newInCore();
final FileMode mode = FileMode.REGULAR_FILE; final FileMode mode = FileMode.REGULAR_FILE;
final String[] paths = { "a.", "a/b", "a/c/e", "a/c/f", "a/d", "a0b" }; final String[] paths = { "a.", "a/b", "a/c/e", "a/c/f", "a/d", "a0b" };
@ -236,7 +236,7 @@ public class DirCacheIteratorTest extends RepositoryTestCase {
} }
public void testTwoLevelSubtree_FilterPath() throws Exception { public void testTwoLevelSubtree_FilterPath() throws Exception {
final DirCache dc = db.readDirCache(); final DirCache dc = DirCache.newInCore();
final FileMode mode = FileMode.REGULAR_FILE; final FileMode mode = FileMode.REGULAR_FILE;
final String[] paths = { "a.", "a/b", "a/c/e", "a/c/f", "a/d", "a0b" }; final String[] paths = { "a.", "a/b", "a/c/e", "a/c/f", "a/d", "a0b" };

Loading…
Cancel
Save