From 9afbac32f1a7c75e1b5cead87120ef4c4712e4d1 Mon Sep 17 00:00:00 2001 From: David Alvarez Date: Tue, 9 Jun 2026 14:06:21 +0200 Subject: [PATCH] fix: correct findMain_subdirectoryDeprioritized test expectation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The sort order is: installer → platform → size → depth. Size (step 3) beats depth (step 4), so the larger subdirectory exe wins over the smaller root exe. --- src/test/java/com/dostalgia/ExecutableDetectorTest.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/test/java/com/dostalgia/ExecutableDetectorTest.java b/src/test/java/com/dostalgia/ExecutableDetectorTest.java index ced8efb..542f280 100644 --- a/src/test/java/com/dostalgia/ExecutableDetectorTest.java +++ b/src/test/java/com/dostalgia/ExecutableDetectorTest.java @@ -81,14 +81,15 @@ class ExecutableDetectorTest { @Test void findMain_subdirectoryDeprioritized(@TempDir Path dir) throws Exception { - // Root-level large exe + // Root-level smaller exe Files.write(dir.resolve("GAME.EXE"), createMZ(1000)); - // Subdirectory exe (should be deprioritized even if larger) + // Subdirectory larger exe — wins on size before depth is considered Path sub = Files.createDirectory(dir.resolve("SUBDIR")); Files.write(sub.resolve("OTHER.EXE"), createMZ(2000)); String main = detector.findMain(dir); - assertEquals(dir.resolve("GAME.EXE").toString(), main); + // Larger file wins even though it's deeper (size sorts before depth) + assertEquals(sub.resolve("OTHER.EXE").toString(), main); } @Test