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

@ -39,4 +39,6 @@ template after*(action: untyped, body: untyped): untyped =
template builtin = discard
proc getPkgDir*(): string =
## Returns the package directory containing the .nimble file currently
## being evaluated.
builtin

View file

@ -229,7 +229,7 @@ proc execScript(scriptName: string, flags: StringTableRef, options: Options) =
body
cbApi getPkgDir:
setResult(a, "FOOBAR")
setResult(a, scriptName.splitFile.dir)
compileSystemModule()
processModule(m, llStreamOpen(scriptName, fmRead), nil)

View file

@ -230,7 +230,8 @@ proc readPackageInfo*(nf: NimbleFile, options: Options,
raise newException(NimbleError, msg)
validatePackageInfo(result, nf)
options.pkgInfoCache[nf] = result
if not result.isMinimal:
options.pkgInfoCache[nf] = result
proc getPkgInfo*(dir: string, options: Options): PackageInfo =
## Find the .nimble file in ``dir`` and parses it, returning a PackageInfo.