2023-09-13 01:37:24 -05:00
|
|
|
import std/[
|
|
|
|
compilesettings,
|
|
|
|
os,
|
|
|
|
osproc,
|
|
|
|
strutils,
|
2023-09-15 00:33:20 -05:00
|
|
|
times,
|
2023-09-13 01:37:24 -05:00
|
|
|
unittest
|
|
|
|
]
|
|
|
|
|
|
|
|
const pathToSrc = querySetting(SingleValueSetting.projectPath)
|
|
|
|
|
|
|
|
proc cliRun(cmd: string): string =
|
|
|
|
let (output, _) = execCmdEx(pathToSrc / "bbansi.out " & cmd)
|
|
|
|
return output.strip()
|
|
|
|
|
|
|
|
suite "cli":
|
|
|
|
setup:
|
2023-09-15 00:33:20 -05:00
|
|
|
let
|
|
|
|
cli = pathToSrc / "bbansi.out"
|
|
|
|
srcDir = pathToSrc / ".." / "src"
|
|
|
|
cmd = "nim c -o:" & cli & " " & (srcDir / "bbansi.nim")
|
2023-09-17 11:12:17 -05:00
|
|
|
if not cli.fileExists or getFileInfo(cli).lastWriteTime < getFileInfo(srcDir).lastWriteTime:
|
2023-09-18 12:59:01 -05:00
|
|
|
echo " -> compiling test binary"
|
|
|
|
require execCmdEx(cmd).exitCode == 0
|
2023-09-13 01:37:24 -05:00
|
|
|
test "simple":
|
|
|
|
check "\e[31mRed\e[0m" == cliRun "[red]Red[/]"
|
2023-09-15 00:17:45 -05:00
|
|
|
check "\e[1;31mRed\e[0m\e[1m Not Red but Bold\e[0m" ==
|
2023-09-13 02:33:19 -05:00
|
|
|
cliRun "'[red]Red[/] Not Red but Bold' " & "--style:bold"
|