Skip to content

Commit e04248c

Browse files
committed
Unit test for ignoring paths
1 parent aaedc88 commit e04248c

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

jsync-engine/src/test/java/com/fizzed/jsync/engine/JsyncEngineTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ public void syncIgnoreDir() throws Exception {
604604

605605
Path sourceBDir = this.syncSourceDir.resolve("b");
606606
Path sourceCFile = this.syncSourceDir.resolve("b/c.txt");
607-
Path sourceDFile = this.syncSourceDir.resolve("b/d.txt");
607+
Path sourceDFile = this.syncSourceDir.resolve("b/sub/sub2/d.txt");
608608
this.writeFile(sourceCFile, "hello");
609609
this.writeFile(sourceDFile, "hello");
610610

@@ -614,17 +614,18 @@ public void syncIgnoreDir() throws Exception {
614614
this.writeFile(targetBFile, "hello");
615615
Path targetBDir = this.syncTargetDir.resolve("b");
616616
Path targetCDir = this.syncTargetDir.resolve("c");
617-
Path targetEFile = this.syncTargetDir.resolve("c/e.txt");
617+
Path targetEFile = this.syncTargetDir.resolve("c/sub/sub2/e.txt");
618618
this.writeFile(targetEFile, "hello");
619619

620620
final JsyncResult result = new JsyncEngine()
621-
.addIgnore("c")
622-
.addIgnore("b")
621+
.addIgnore("c") // target dir should not be deleted
622+
.addIgnore("b") // b should not be synced to target
623623
.setDelete(true)
624624
.sync(this.syncSourceDir, this.syncTargetDir, JsyncMode.MERGE);
625625

626626
assertThat(targetADir).isDirectory();
627627
assertThat(targetBDir).doesNotExist();
628+
assertThat(targetCDir).exists();
628629
assertThat(targetEFile).isRegularFile();
629630
}
630631

0 commit comments

Comments
 (0)