From 565880e69a6f0db92cc293ba29ff86af1d55af74 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Fri, 15 Sep 2023 00:33:20 -0500 Subject: [PATCH] tests: make test binary compilation conditional --- tests/tcli.nim | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/tcli.nim b/tests/tcli.nim index 3d69bef..83260ee 100644 --- a/tests/tcli.nim +++ b/tests/tcli.nim @@ -3,6 +3,7 @@ import std/[ os, osproc, strutils, + times, unittest ] @@ -14,9 +15,12 @@ proc cliRun(cmd: string): string = suite "cli": setup: - let cmd = "nim c -o:" & pathToSrc / "bbansi.out " & (pathToSrc / ".." / - "src" / "bbansi.nim") - check execCmdEx(cmd).exitCode == 0 + let + cli = pathToSrc / "bbansi.out" + srcDir = pathToSrc / ".." / "src" + cmd = "nim c -o:" & cli & " " & (srcDir / "bbansi.nim") + if getFileInfo(cli).lastWriteTime < getFileInfo(srcDir).lastWriteTime: + check execCmdEx(cmd).exitCode == 0 test "simple": check "\e[31mRed\e[0m" == cliRun "[red]Red[/]" check "\e[1;31mRed\e[0m\e[1m Not Red but Bold\e[0m" ==