Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBasicTest.java')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBasicTest.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBasicTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBasicTest.java
index b6e4e42c7e..487f04329d 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBasicTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBasicTest.java
@@ -43,13 +43,20 @@
package org.eclipse.jgit.dircache;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.File;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.FileMode;
import org.eclipse.jgit.lib.RepositoryTestCase;
+import org.junit.Test;
public class DirCacheBasicTest extends RepositoryTestCase {
+ @Test
public void testReadMissing_RealIndex() throws Exception {
final File idx = new File(db.getDirectory(), "index");
assertFalse(idx.exists());
@@ -59,6 +66,7 @@ public class DirCacheBasicTest extends RepositoryTestCase {
assertEquals(0, dc.getEntryCount());
}
+ @Test
public void testReadMissing_TempIndex() throws Exception {
final File idx = new File(db.getDirectory(), "tmp_index");
assertFalse(idx.exists());
@@ -68,6 +76,7 @@ public class DirCacheBasicTest extends RepositoryTestCase {
assertEquals(0, dc.getEntryCount());
}
+ @Test
public void testLockMissing_RealIndex() throws Exception {
final File idx = new File(db.getDirectory(), "index");
final File lck = new File(db.getDirectory(), "index.lock");
@@ -85,6 +94,7 @@ public class DirCacheBasicTest extends RepositoryTestCase {
assertFalse(lck.exists());
}
+ @Test
public void testLockMissing_TempIndex() throws Exception {
final File idx = new File(db.getDirectory(), "tmp_index");
final File lck = new File(db.getDirectory(), "tmp_index.lock");
@@ -102,6 +112,7 @@ public class DirCacheBasicTest extends RepositoryTestCase {
assertFalse(lck.exists());
}
+ @Test
public void testWriteEmptyUnlock_RealIndex() throws Exception {
final File idx = new File(db.getDirectory(), "index");
final File lck = new File(db.getDirectory(), "index.lock");
@@ -118,6 +129,7 @@ public class DirCacheBasicTest extends RepositoryTestCase {
assertFalse(lck.exists());
}
+ @Test
public void testWriteEmptyCommit_RealIndex() throws Exception {
final File idx = new File(db.getDirectory(), "index");
final File lck = new File(db.getDirectory(), "index.lock");
@@ -135,6 +147,7 @@ public class DirCacheBasicTest extends RepositoryTestCase {
assertEquals(12 + 20, idx.length());
}
+ @Test
public void testWriteEmptyReadEmpty_RealIndex() throws Exception {
final File idx = new File(db.getDirectory(), "index");
final File lck = new File(db.getDirectory(), "index.lock");
@@ -152,6 +165,7 @@ public class DirCacheBasicTest extends RepositoryTestCase {
}
}
+ @Test
public void testWriteEmptyLockEmpty_RealIndex() throws Exception {
final File idx = new File(db.getDirectory(), "index");
final File lck = new File(db.getDirectory(), "index.lock");
@@ -172,6 +186,7 @@ public class DirCacheBasicTest extends RepositoryTestCase {
}
}
+ @Test
public void testBuildThenClear() throws Exception {
final DirCache dc = db.readDirCache();
@@ -194,6 +209,7 @@ public class DirCacheBasicTest extends RepositoryTestCase {
assertFalse(dc.hasUnmergedPaths());
}
+ @Test
public void testDetectUnmergedPaths() throws Exception {
final DirCache dc = db.readDirCache();
final DirCacheEntry[] ents = new DirCacheEntry[3];
@@ -212,6 +228,7 @@ public class DirCacheBasicTest extends RepositoryTestCase {
assertTrue(dc.hasUnmergedPaths());
}
+ @Test
public void testFindOnEmpty() throws Exception {
final DirCache dc = DirCache.newInCore();
final byte[] path = Constants.encode("a");

Back to the top