Fix issue #597 - error if bin is a source file

This commit is contained in:
Ganesh Viswanathan 2019-06-02 00:42:41 -05:00 committed by Dominik Picheta
commit 016f42c34a
4 changed files with 20 additions and 0 deletions

2
src/nimblepkg/packageparser.nim Executable file → Normal file
View file

@ -253,6 +253,8 @@ proc readPackageInfoFromNimble(path: string; result: var PackageInfo) =
result.installExt.add(ev.value.multiSplit)
of "bin":
for i in ev.value.multiSplit:
if i.splitFile().ext == ".nim":
raise newException(NimbleError, "`bin` entry should not be a source file: " & i)
result.bin.add(i.addFileExt(ExeExt))
of "backend":
result.backend = ev.value.toLowerAscii()

View file

@ -0,0 +1,12 @@
# Package
version = "0.1.0"
author = "Author"
description = "dummy"
license = "MIT"
# Dependencies
requires "nim >= 0.17.0"
bin = @["test.nim"]

0
tests/issue597/test.nim Normal file
View file

View file

@ -585,6 +585,12 @@ test "can pass args with spaces to Nim (#351)":
checkpoint output
check exitCode == QuitSuccess
test "error if `bin` is a source file (#597)":
cd "issue597":
var (output, exitCode) = execNimble("build")
check exitCode != QuitSuccess
check output.contains("entry should not be a source file: test.nim")
suite "reverse dependencies":
test "basic test":
cd "revdep/mydep":