summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/modulepaths.nim1
-rw-r--r--tests/dir with space/more spaces/mspace.nim1
-rw-r--r--tests/dir with space/tspace.nim4
3 files changed, 5 insertions, 1 deletions
diff --git a/compiler/modulepaths.nim b/compiler/modulepaths.nim
index 9e27a2d7d..129f719e2 100644
--- a/compiler/modulepaths.nim
+++ b/compiler/modulepaths.nim
@@ -114,7 +114,6 @@ proc getModuleName*(conf: ConfigRef; n: PNode): string =
     try:
       result =
         pathSubs(conf, n.strVal, toFullPath(conf, n.info).splitFile().dir)
-          .replace(" ")
     except ValueError:
       localError(conf, n.info, "invalid path: " & n.strVal)
       result = n.strVal
diff --git a/tests/dir with space/more spaces/mspace.nim b/tests/dir with space/more spaces/mspace.nim
new file mode 100644
index 000000000..bc2c90f5e
--- /dev/null
+++ b/tests/dir with space/more spaces/mspace.nim
@@ -0,0 +1 @@
+proc tenTimes*(x: int): int = 10*x
diff --git a/tests/dir with space/tspace.nim b/tests/dir with space/tspace.nim
index 59237c9a1..87a52c271 100644
--- a/tests/dir with space/tspace.nim
+++ b/tests/dir with space/tspace.nim
@@ -2,5 +2,9 @@ discard """
 output: "Successful"
 """
 # Test for the compiler to be able to compile a Nim file with spaces in the directory name.
+# Also test if import of a directory with a space works.
 
+import "more spaces" / mspace
+
+assert tenTimes(5) == 50
 echo("Successful")
ight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
discard """
  output: '''-1abc'''
"""

var
  a {.compileTime.} = 2
  b = -1
  c {.compileTime.} = 3
  d = "abc"

static:
  assert a == 2
  assert c == 3

echo b, d