Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't hardcode module names in tmoduletests.nim #988

Merged
merged 2 commits into from
Feb 8, 2022
Merged
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
16 changes: 2 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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