Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions tests/imports.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import std/macros
import std/os
import std/strutils

macro importTests*(dir: static string): untyped =
macro importTests*(dir: static string, excludes: static string = ""): untyped =
## imports all files in the specified directory whose filename
## starts with "test" and ends in ".nim"
let imports = newStmtList()
let excludeList = excludes.split(",")
for file in walkDirRec(dir):
let (_, name, ext) = splitFile(file)
if name.startsWith("test") and ext == ".nim":
if name.startsWith("test") and ext == ".nim" and not (name in excludeList):
imports.add(
quote do:
import `file`
Expand Down
7 changes: 6 additions & 1 deletion tests/testIntegration.nim
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ when includes != "":
importAll(includes.split(","))
else:
# import all tests in the integration/ directory
importTests(currentSourcePath().parentDir() / "integration")
importTests(
currentSourcePath().parentDir() / "integration" / "1_minute", "testpurchasing"
)
importTests(
currentSourcePath().parentDir() / "integration" / "5_minutes", "testsales"
)

{.warning[UnusedImport]: off.}
Loading