summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-09-08 20:33:18 +0200
committerGitHub <noreply@github.com>2019-09-08 20:33:18 +0200
commitf915064e07c31b0be88bb39553764dd9f1c6c915 (patch)
tree8d97e29489e456954b7c256a7777995cc6d4f891
parente5139b066294d0411fc81d545cc921545d7d5d8e (diff)
parent3eb89481cbee34c8bf4f377205d1ce514ef1838f (diff)
downloadNim-f915064e07c31b0be88bb39553764dd9f1c6c915.tar.gz
fix #12130 ; improve naming scheme in fakePackageName (#12149)
* fix #12130 ; improve naming scheme in fakePackageName

* fix tests
-rw-r--r--compiler/packagehandling.nim8
-rw-r--r--testament/testament.nim3
2 files changed, 4 insertions, 7 deletions
diff --git a/compiler/packagehandling.nim b/compiler/packagehandling.nim
index b9db61b4d..54fbe23a4 100644
--- a/compiler/packagehandling.nim
+++ b/compiler/packagehandling.nim
@@ -39,13 +39,11 @@ proc getPackageName*(conf: ConfigRef; path: string): string =
     if parents <= 0: break
 
 proc fakePackageName*(conf: ConfigRef; path: AbsoluteFile): string =
-  # foo/../bar becomes foo7_7bar
-  result = relativeTo(path, conf.projectPath, '/').string.multiReplace(
-    {"/": "7", "..": "_", "7": "77", "_": "__", ":": "8", "8": "88"})
+  # foo/../bar becomes foo@..@bar
+  result = relativeTo(path, conf.projectPath, '/').string.multiReplace({"/": "@", "@": "@@"})
 
 proc demanglePackageName*(path: string): string =
-  result = path.multiReplace(
-    {"88": "8", "8": ":", "77": "7", "__": "_", "_7": "../", "7": "/"})
+  result = path.multiReplace({"@@": "@", "@": "/"})
 
 proc withPackageName*(conf: ConfigRef; path: AbsoluteFile): AbsoluteFile =
   let x = getPackageName(conf, path.string)
diff --git a/testament/testament.nim b/testament/testament.nim
index 5d0213ce5..41dca39ae 100644
--- a/testament/testament.nim
+++ b/testament/testament.nim
@@ -332,8 +332,7 @@ proc generatedFile(test: TTest, target: TTarget): string =
   else:
     let (_, name, _) = test.name.splitFile
     let ext = targetToExt[target]
-    result = nimcacheDir(test.name, test.options, target) /
-              name.replace("_", "__").changeFileExt(ext)
+    result = nimcacheDir(test.name, test.options, target) / name.changeFileExt(ext)
 
 proc needsCodegenCheck(spec: TSpec): bool =
   result = spec.maxCodeSize > 0 or spec.ccodeCheck.len > 0