Skip to content

Commit

Permalink
Don't hardcode module names in tmoduletests.nim
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberTailor committed Feb 6, 2022
1 parent d894b15 commit 92afc17
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@ jobs:
run: |
cd tests
nim c -r tester
# there's no need to add nimblepkg unit tests --
# they are run by tmoduletests.nim
- run: ./src/nimble install -y
26 changes: 8 additions & 18 deletions tests/tmoduletests.nim
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,15 @@

{.used.}

import unittest, os, osproc
from nimblepkg/common import cd
import unittest, os, osproc, strutils

suite "Module tests":
template moduleTest(moduleName: string) =
template moduleTest(modulePath: string) =
let moduleName = splitFile(modulePath).name
test moduleName:
cd "..":
check execCmdEx("nim c -r src/nimblepkg/" & moduleName).
exitCode == QuitSuccess
check execCmdEx("nim c -r " & modulePath).
exitCode == QuitSuccess

moduleTest "common"
moduleTest "download"
moduleTest "jsonhelpers"
moduleTest "packageinfo"
moduleTest "packageparser"
moduleTest "paths"
moduleTest "reversedeps"
moduleTest "sha1hashes"
moduleTest "tools"
moduleTest "topologicalsort"
moduleTest "vcstools"
moduleTest "version"
for module in walkDir("../src/nimblepkg"):
if readFile(module.path).contains("unittest"):
moduleTest module.path

0 comments on commit 92afc17

Please sign in to comment.