diff --git a/src/test/java/me/itzg/helpers/find/FindCommandTest.java b/src/test/java/me/itzg/helpers/find/FindCommandTest.java index c12743a7..9949c2c6 100644 --- a/src/test/java/me/itzg/helpers/find/FindCommandTest.java +++ b/src/test/java/me/itzg/helpers/find/FindCommandTest.java @@ -416,6 +416,29 @@ void excludesByFiles() throws Exception { ); } + @Test + void deleteWithExcludesByFilesInSubdir() throws Exception { + final Path a = Files.createFile(tempDir.resolve("a.txt")); + final Path subdir = Files.createDirectories(tempDir.resolve("subdir")); + final Path datFile = Files.createFile(subdir.resolve("b.dat")); + final Path c = Files.createFile(tempDir.resolve("c.cfg")); + + final int exitCode = new CommandLine(new FindCommand()) + .execute( + "--delete", + "--type", "f", + "--name=*", + "--exclude-name=*.dat", + tempDir.toString() + ); + + assertThat(exitCode).isEqualTo(ExitCode.OK); + + assertThat(datFile).exists(); + assertThat(a).doesNotExist(); + assertThat(c).doesNotExist(); + } + @Test void excludesByDirectory() throws Exception { Files.createFile(