|
1 | 1 | {.used.} |
2 | | -import unittest, os#, strformat, osproc |
| 2 | +import unittest, os, strutils# strformat, osproc |
3 | 3 | import testscommon |
4 | 4 | from nimblepkg/common import cd |
5 | 5 |
|
@@ -35,3 +35,38 @@ suite "requires flag": |
35 | 35 | # check output.processOutput.inLines("Installing [email protected]") |
36 | 36 |
|
37 | 37 |
|
| 38 | + |
| 39 | + test "should be able to install a special version": |
| 40 | + #[ |
| 41 | + Test it can install a dep with the following variations: |
| 42 | + - https://github.com/status-im/nim-json-serialization.git#lean-arrays |
| 43 | + - https://github.com/status-im/nim-json-serialization.git#4cd31594f868a3d3cb81ec9d5f479efbe2466ebd |
| 44 | + - json_serialization#lean-arrays |
| 45 | + - json_serialization#4cd31594f868a3d3cb81ec9d5f479efbe2466ebd |
| 46 | + ]# |
| 47 | + let requires = [ |
| 48 | + "https://github.com/status-im/nim-json-serialization.git#nimble_test_dont_delete", |
| 49 | + "https://github.com/status-im/nim-json-serialization.git#e45fe67d71f006f15a32f90a5a56a4775982d951", |
| 50 | + "json_serialization#nimble_test_dont_delete", |
| 51 | + "json_serialization#e45fe67d71f006f15a32f90a5a56a4775982d951", |
| 52 | + "json_serialization == 0.2.9" |
| 53 | + ] |
| 54 | + cleanDir(installDir) |
| 55 | + cd "gitversions": |
| 56 | + for req in requires: |
| 57 | + let require = "--requires: " & req |
| 58 | + let isVersion = req.contains("==") |
| 59 | + # echo "Trying require: ", req |
| 60 | + let (output, exitCode) = execNimble("install", require) |
| 61 | + let pkgDir = getPackageDir(pkgsDir, "json_serialization-0.2.9") |
| 62 | + check exitCode == QuitSuccess |
| 63 | + let nimbleTestDontDeleteFile = pkgDir / "json_serialization" / "nimble.test.nim" |
| 64 | + # echo "Nimble test dont delete file: ", nimbleTestDontDeleteFile |
| 65 | + if isVersion: |
| 66 | + check output.processOutput.inLines("Success: json_serialization installed successfully.") |
| 67 | + check not fileExists(nimbleTestDontDeleteFile) |
| 68 | + else: |
| 69 | + check output.processOutput.inLines("Success: json_serialization installed successfully.") |
| 70 | + check fileExists(nimbleTestDontDeleteFile) |
| 71 | + cleanDir(pkgDir) #Resets the package dir for each require |
| 72 | + |
0 commit comments