Skip to content

Commit 6a2cf71

Browse files
authored
Merge pull request #988 from CyberTailor/feature/actions
Don't hardcode module names in tmoduletests.nim
2 parents 6718a6d + 92afc17 commit 6a2cf71

File tree

2 files changed

+10
-32
lines changed

2 files changed

+10
-32
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,10 @@ jobs:
2727
- name: Install Mercurial on macOS
2828
if: matrix.os == 'macos-latest'
2929
run: brew install mercurial
30-
- name: Run nimblepkg unit tests
31-
run: |
32-
cd src/nimblepkg
33-
nim c -r download
34-
nim c -r jsonhelpers
35-
nim c -r packageinfo
36-
nim c -r packageparser
37-
nim c -r paths
38-
nim c -r reversedeps
39-
nim c -r sha1hashes
40-
nim c -r tools
41-
nim c -r topologicalsort
42-
nim c -r vcstools
43-
nim c -r version
4430
- name: Run nim c -r tester
4531
run: |
4632
cd tests
4733
nim c -r tester
34+
# there's no need to add nimblepkg unit tests --
35+
# they are run by tmoduletests.nim
4836
- run: ./src/nimble install -y

tests/tmoduletests.nim

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,15 @@
33

44
{.used.}
55

6-
import unittest, os, osproc
7-
from nimblepkg/common import cd
6+
import unittest, os, osproc, strutils
87

98
suite "Module tests":
10-
template moduleTest(moduleName: string) =
9+
template moduleTest(modulePath: string) =
10+
let moduleName = splitFile(modulePath).name
1111
test moduleName:
12-
cd "..":
13-
check execCmdEx("nim c -r src/nimblepkg/" & moduleName).
14-
exitCode == QuitSuccess
12+
check execCmdEx("nim c -r " & modulePath).
13+
exitCode == QuitSuccess
1514

16-
moduleTest "common"
17-
moduleTest "download"
18-
moduleTest "jsonhelpers"
19-
moduleTest "packageinfo"
20-
moduleTest "packageparser"
21-
moduleTest "paths"
22-
moduleTest "reversedeps"
23-
moduleTest "sha1hashes"
24-
moduleTest "tools"
25-
moduleTest "topologicalsort"
26-
moduleTest "vcstools"
27-
moduleTest "version"
15+
for module in walkDir("../src/nimblepkg"):
16+
if readFile(module.path).contains("unittest"):
17+
moduleTest module.path

0 commit comments

Comments
 (0)