diff --git a/src/nimble.nim b/src/nimble.nim index 87b0996..582912b 100644 --- a/src/nimble.nim +++ b/src/nimble.nim @@ -988,12 +988,14 @@ proc develop(options: Options) = developFromDir(downloadDir / subdir, options) proc test(options: Options) = - ## Executes all tests. + ## Executes all tests starting with 't' in the ``tests`` directory. + ## Subdirectories are not walked. var files = toSeq(walkDir(getCurrentDir() / "tests")) files.sort((a, b) => cmp(a.path, b.path)) for file in files: - if file.path.endsWith(".nim") and file.kind in {pcFile, pcLinkToFile}: + let (_, name, ext) = file.path.splitFile() + if ext == ".nim" and name[0] == 't' and file.kind in {pcFile, pcLinkToFile}: var optsCopy = options.briefClone() optsCopy.action.typ = actionCompile optsCopy.action.file = file.path diff --git a/tests/testCommand/testsFail/tests/a.nim b/tests/testCommand/testsFail/tests/t1.nim similarity index 100% rename from tests/testCommand/testsFail/tests/a.nim rename to tests/testCommand/testsFail/tests/t1.nim diff --git a/tests/testCommand/testsFail/tests/b.nim b/tests/testCommand/testsFail/tests/t2.nim similarity index 100% rename from tests/testCommand/testsFail/tests/b.nim rename to tests/testCommand/testsFail/tests/t2.nim diff --git a/tests/testCommand/testsFail/tests/c.nim b/tests/testCommand/testsFail/tests/t3.nim similarity index 100% rename from tests/testCommand/testsFail/tests/c.nim rename to tests/testCommand/testsFail/tests/t3.nim diff --git a/tests/testCommand/testsIgnore/testing123.nim b/tests/testCommand/testsIgnore/testing123.nim new file mode 100644 index 0000000..2c96a26 --- /dev/null +++ b/tests/testCommand/testsIgnore/testing123.nim @@ -0,0 +1,4 @@ + +proc myFunc*() = + echo "Executing my func" + diff --git a/tests/testCommand/testsIgnore/testing123.nimble b/tests/testCommand/testsIgnore/testing123.nimble new file mode 100644 index 0000000..00e43bf --- /dev/null +++ b/tests/testCommand/testsIgnore/testing123.nimble @@ -0,0 +1,4 @@ +version = "0.1.0" +author = "John Doe" +description = "Nimble Test" +license = "BSD" diff --git a/tests/testCommand/testsIgnore/tests/foobar/tignored.nim b/tests/testCommand/testsIgnore/tests/foobar/tignored.nim new file mode 100644 index 0000000..9d61174 --- /dev/null +++ b/tests/testCommand/testsIgnore/tests/foobar/tignored.nim @@ -0,0 +1 @@ +echo "Should be ignored" diff --git a/tests/testCommand/testsIgnore/tests/ignore.nim b/tests/testCommand/testsIgnore/tests/ignore.nim new file mode 100644 index 0000000..b63fe4d --- /dev/null +++ b/tests/testCommand/testsIgnore/tests/ignore.nim @@ -0,0 +1 @@ +echo "Should be ignored" \ No newline at end of file diff --git a/tests/testCommand/testsIgnore/tests/taccept.nim b/tests/testCommand/testsIgnore/tests/taccept.nim new file mode 100644 index 0000000..e020a08 --- /dev/null +++ b/tests/testCommand/testsIgnore/tests/taccept.nim @@ -0,0 +1,7 @@ +import testing123, unittest + +test "can accept": + echo "First test" + myFunc() + + diff --git a/tests/testCommand/testsPass/tests/one.nim b/tests/testCommand/testsPass/tests/t1.nim similarity index 100% rename from tests/testCommand/testsPass/tests/one.nim rename to tests/testCommand/testsPass/tests/t1.nim diff --git a/tests/testCommand/testsPass/tests/two.nim b/tests/testCommand/testsPass/tests/t2.nim similarity index 100% rename from tests/testCommand/testsPass/tests/two.nim rename to tests/testCommand/testsPass/tests/t2.nim diff --git a/tests/testCommand/testsPass/tests/three.nim b/tests/testCommand/testsPass/tests/t3.nim similarity index 100% rename from tests/testCommand/testsPass/tests/three.nim rename to tests/testCommand/testsPass/tests/t3.nim diff --git a/tests/tester.nim b/tests/tester.nim index efcb619..9ac57df 100644 --- a/tests/tester.nim +++ b/tests/tester.nim @@ -38,7 +38,7 @@ proc execNimble(args: varargs[string]): tuple[output: string, exitCode: int] = let path = getCurrentDir().parentDir() / "src" - let cmd = "PATH=" & path & ":$PATH " & quotedArgs.join(" ") + let cmd = "DYLD_LIBRARY_PATH=/usr/local/opt/openssl@1.1/lib PATH=" & path & ":$PATH " & quotedArgs.join(" ") result = execCmdEx(cmd) checkpoint(result.output) @@ -682,6 +682,13 @@ suite "test command": check exitCode == QuitSuccess check outp.processOutput.inLines("overriden") + test "certain files are ignored": + cd "testCommand/testsIgnore": + let (outp, exitCode) = execNimble("test") + check exitCode == QuitSuccess + check(not outp.processOutput.inLines("Should be ignored")) + check outp.processOutput.inLines("First test") + suite "check command": test "can succeed package": cd "binaryPackage/v1":