File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -963,6 +963,7 @@ proc init(options: Options) =
963
963
raise nimbleError(" Please install git or mercurial first" )
964
964
965
965
# Determine the package name.
966
+ let hasProjectName = options.action.projName != " "
966
967
let pkgName =
967
968
if options.action.projName != " " :
968
969
options.action.projName
@@ -974,7 +975,7 @@ proc init(options: Options) =
974
975
975
976
# Determine the package root.
976
977
let pkgRoot =
977
- if pkgName == os.getCurrentDir().splitPath.tail :
978
+ if not hasProjectName :
978
979
os.getCurrentDir()
979
980
else :
980
981
os.getCurrentDir() / pkgName
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import testscommon
5
5
6
6
# suits imports
7
7
8
+ import tinitcommand
8
9
import tcheckcommand
9
10
import tcleancommand
10
11
import tdevelopfeature
Original file line number Diff line number Diff line change
1
+ {.used.}
2
+
3
+ import unittest, os
4
+ import testscommon
5
+
6
+ from nimblepkg/ common import cd
7
+
8
+ suite " init" :
9
+ # # https://github.com/nim-lang/nimble/pull/983
10
+ test " init within directory that is invalid package name will not create new directory" :
11
+ let tempdir = getTempDir() / " a-b"
12
+ createDir(tempdir)
13
+ cd(tempdir):
14
+ let args = [" init" ]
15
+ let (output, exitCode) = execNimbleYes(args)
16
+ discard output
17
+ check exitCode == QuitSuccess
18
+ check not dirExists(" a_b" )
19
+ check fileExists(" a_b.nimble" )
You can’t perform that action at this time.
0 commit comments