Fixed nims task execution. Added NimScript tests to tester.

This commit is contained in:
Dominik Picheta 2015-12-24 00:58:19 +00:00
commit 9045b401b1
2 changed files with 26 additions and 1 deletions

View file

@ -1105,9 +1105,10 @@ proc doAction(options: Options) =
of actionCustom:
# Custom command. Attempt to call a NimScript task.
let nimbleFile = findNimbleFile(getCurrentDir(), true)
let oldCmd = getNimScriptCommand()
if not nimbleFile.isNimScript():
writeHelp()
let oldCmd = getNimScriptCommand()
if not execTask(nimbleFile, oldCmd):
echo("FAILURE: Could not find task ", oldCmd, " in ", nimbleFile)
writeHelp()

View file

@ -18,6 +18,23 @@ template cd*(dir: string, body: stmt) =
proc processOutput(output: string): seq[string] =
output.strip.splitLines().filter((x: string) => (x.len > 0))
test "can install nimscript package":
cd "nimscript":
check execCmdEx("../" & path & " install -y").exitCode == QuitSuccess
test "can execute nimscript tasks":
cd "nimscript":
let (output, exitCode) = execCmdEx("../" & path & " test")
let lines = output.strip.splitLines()
check exitCode == QuitSuccess
check lines[^1] == "10"
test "can list nimscript tasks":
cd "nimscript":
let (output, exitCode) = execCmdEx("../" & path & " tasks")
check output.strip == "test test description"
check exitCode == QuitSuccess
test "can install packagebin2":
check execCmdEx(path &
" install -y https://github.com/nimble-test/packagebin2.git").exitCode ==
@ -48,6 +65,11 @@ test "issue #27":
cd "issue27":
check execCmdEx("../" & path & " install -y").exitCode == QuitSuccess
test "can list":
check execCmdEx(path & " list").exitCode == QuitSuccess
check execCmdEx(path & " list -i").exitCode == QuitSuccess
test "can uninstall":
block:
let (outp, exitCode) = execCmdEx(path & " uninstall -y issue27b")
@ -80,3 +102,5 @@ test "can uninstall":
check execCmdEx(path & " uninstall -y PackageA@0.2 issue27b").exitCode ==
QuitSuccess
check (not dirExists(getHomeDir() / ".nimble" / "pkgs" / "PackageA-0.2.0"))
check execCmdEx(path & " uninstall -y nimscript").exitCode == QuitSuccess