2022-01-04 16:21:15 +00:00
|
|
|
import os, strutils
|
2018-11-21 13:25:53 +00:00
|
|
|
mode = ScriptMode.Verbose
|
|
|
|
|
|
|
|
packageName = "confutils"
|
|
|
|
version = "0.1.0"
|
|
|
|
author = "Status Research & Development GmbH"
|
|
|
|
description = "Simplified handling of command line options and config files"
|
|
|
|
license = "Apache License 2.0"
|
|
|
|
skipDirs = @["tests"]
|
|
|
|
|
2020-03-24 15:31:05 +00:00
|
|
|
requires "nim >= 1.0.0",
|
2020-10-20 08:35:47 +00:00
|
|
|
"stew"
|
2018-11-21 13:25:53 +00:00
|
|
|
|
2022-01-04 16:21:15 +00:00
|
|
|
proc run(args, path: string) =
|
|
|
|
exec "nim " & getEnv("TEST_LANG", "c") & " " & getEnv("NIMFLAGS") & " " & args &
|
2022-02-24 20:43:04 +00:00
|
|
|
" --hints:off --warnings:on --skipParentCfg --skipUserCfg" &
|
|
|
|
" --styleCheck:usages --styleCheck:error " & path
|
2022-01-04 16:21:15 +00:00
|
|
|
|
2020-10-20 08:35:47 +00:00
|
|
|
task test, "Run all tests":
|
2022-01-04 16:21:15 +00:00
|
|
|
run("--threads:off -d:release -r", "tests/test_all")
|
|
|
|
run("--threads:on -d:release -r", "tests/test_all")
|
2021-09-02 08:12:38 +00:00
|
|
|
|
2022-01-04 16:21:15 +00:00
|
|
|
run("--threads:off -d:release", "tests/test_duplicates")
|
|
|
|
run("--threads:on -d:release", "tests/test_duplicates")
|
2021-09-02 08:12:38 +00:00
|
|
|
|
|
|
|
#Also iterate over every test in tests/fail, and verify they fail to compile.
|
|
|
|
echo "\r\nTest Fail to Compile:"
|
|
|
|
for path in listFiles(thisDir() / "tests" / "fail"):
|
|
|
|
if path.split(".")[^1] != "nim":
|
|
|
|
continue
|
|
|
|
|
|
|
|
if gorgeEx("nim c " & path).exitCode != 0:
|
|
|
|
echo " [OK] ", path.split(DirSep)[^1]
|
|
|
|
else:
|
|
|
|
echo " [FAILED] ", path.split(DirSep)[^1]
|
2022-01-04 16:21:15 +00:00
|
|
|
quit(QuitFailure)
|