Skip to content

Commit

Permalink
testClean
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Glick committed Jun 5, 2012
1 parent bc325ca commit 116ab22
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/test/java/hudson/plugins/mercurial/MercurialSCMTest.java
@@ -1,5 +1,6 @@
package hudson.plugins.mercurial;

import hudson.FilePath;
import hudson.Launcher;
import hudson.Proc;
import hudson.model.AbstractBuild;
Expand All @@ -26,6 +27,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;

import org.jvnet.hudson.test.Bug;
import org.jvnet.hudson.test.FakeLauncher;
Expand Down Expand Up @@ -380,6 +382,26 @@ public void testSubdirectoryCheckout() throws Exception {
assertFalse(it.hasNext());
}

public void testClean() throws Exception {
FreeStyleProject p = createFreeStyleProject();
p.setScm(new MercurialSCM(hgInstallation(), repo.getPath(), null, null, null, null, true));
hg(repo, "init");
touchAndCommit(repo, "f1");
buildAndCheck(p, "f1");
FilePath ws = p.getLastBuild().getWorkspace();
ws.child("junk1").write("junk", null);
ws.child("junk2").write("junk", null);
// from Hg 1.3 changelog: "update: don't unlink added files when -C/--clean is specified"
hg(new File(ws.getRemote()), "add", "junk2");
touchAndCommit(repo, "f2");
buildAndCheck(p, "f2");
Set<String> kids = new TreeSet<String>();
for (FilePath kid : ws.list()) {
kids.add(kid.getName());
}
assertEquals("[.hg, f1, f2]", kids.toString());
}

public void testMultipleProjectsForSingleSource() throws Exception {
FreeStyleProject one = createFreeStyleProject();
FreeStyleProject two = createFreeStyleProject();
Expand Down

0 comments on commit 116ab22

Please sign in to comment.