diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index efc0ea54..fccfde59 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,22 +27,10 @@ jobs: - name: Install Mercurial on macOS if: matrix.os == 'macos-latest' run: brew install mercurial - - name: Run nimblepkg unit tests - run: | - cd src/nimblepkg - nim c -r download - nim c -r jsonhelpers - nim c -r packageinfo - nim c -r packageparser - nim c -r paths - nim c -r reversedeps - nim c -r sha1hashes - nim c -r tools - nim c -r topologicalsort - nim c -r vcstools - nim c -r version - name: Run nim c -r tester 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 diff --git a/tests/tmoduletests.nim b/tests/tmoduletests.nim index 87cb22c0..8dc9d4d9 100644 --- a/tests/tmoduletests.nim +++ b/tests/tmoduletests.nim @@ -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