Fix tests. Add test for hooks.

This commit is contained in:
Dominik Picheta 2015-12-30 20:20:04 +00:00
commit 1fa209a689
6 changed files with 49 additions and 8 deletions

View file

@ -22,4 +22,19 @@ task cr, "Testing `nimble c -r nimscript.nim` via setCommand":
setCommand "c", "nimscript.nim"
task api, "Testing nimscriptapi module functionality":
echo(getPkgDir())
echo(getPkgDir())
before hooks:
echo("First")
task hooks, "Testing the hooks":
echo("Middle")
after hooks:
echo("last")
before hooks2:
return false
task hooks2, "Testing the hooks again":
echo("Shouldn't happen")

View file

@ -34,8 +34,7 @@ test "issue 113 (uninstallation problems)":
let (output, exitCode) = execCmdEx(path & " remove -y c")
let lines = output.strip.splitLines()
check exitCode != QuitSuccess
check "cannot uninstall c (0.1.0) because b (0.1.0) depends on it" in
lines[^1].normalize
check inLines(lines, "cannot uninstall c (0.1.0) because b (0.1.0) depends on it")
check execCmdEx(path & " remove -y a").exitCode == QuitSuccess
check execCmdEx(path & " remove -y b").exitCode == QuitSuccess
@ -113,6 +112,23 @@ test "can list nimscript tasks":
check "test test description".normalize in output.normalize
check exitCode == QuitSuccess
test "can use pre/post hooks":
cd "nimscript":
let (output, exitCode) = execCmdEx("../" & path & " hooks")
let lines = output.strip.splitLines()
check exitCode == QuitSuccess
check inLines(lines, "First")
check inLines(lines, "middle")
check inLines(lines, "last")
test "pre hook can prevent action":
cd "nimscript":
let (output, exitCode) = execCmdEx("../" & path & " hooks2")
let lines = output.strip.splitLines()
check exitCode == QuitSuccess
check(not inLines(lines, "Shouldn't happen"))
check inLines(lines, "Hook prevented further execution")
test "can install packagebin2":
check execCmdEx(path &
" install -y https://github.com/nimble-test/packagebin2.git").exitCode ==