From 22aa3c1d1392d7878d039250ecf0ffeadf3ba0cc Mon Sep 17 00:00:00 2001 From: Jabba Laci Date: Sat, 20 Oct 2018 00:40:41 +0200 Subject: [PATCH] #555: `nimble test` removes the created binaries (#566) --- src/nimble.nim | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/nimble.nim b/src/nimble.nim index 807abdc..fe165d7 100644 --- a/src/nimble.nim +++ b/src/nimble.nim @@ -1002,7 +1002,17 @@ proc test(options: Options) = optsCopy.action.compileOptions = @[] optsCopy.action.compileOptions.add("-r") optsCopy.action.compileOptions.add("--path:.") + let + binFileName = file.path.changeFileExt(ExeExt) + existsBefore = existsFile(binFileName) + execBackend(optsCopy) + + let + existsAfter = existsFile(binFileName) + canRemove = not existsBefore and existsAfter + if canRemove: + removeFile(binFileName) display("Success:", "All tests passed", Success, HighPriority)