* fix #12130 ; improve naming scheme in fakePackageName * fix tests
This commit is contained in:
commit
f915064e07
2 changed files with 4 additions and 7 deletions
|
|
@ -39,13 +39,11 @@ proc getPackageName*(conf: ConfigRef; path: string): string =
|
||||||
if parents <= 0: break
|
if parents <= 0: break
|
||||||
|
|
||||||
proc fakePackageName*(conf: ConfigRef; path: AbsoluteFile): string =
|
proc fakePackageName*(conf: ConfigRef; path: AbsoluteFile): string =
|
||||||
# foo/../bar becomes foo7_7bar
|
# foo/../bar becomes foo@..@bar
|
||||||
result = relativeTo(path, conf.projectPath, '/').string.multiReplace(
|
result = relativeTo(path, conf.projectPath, '/').string.multiReplace({"/": "@", "@": "@@"})
|
||||||
{"/": "7", "..": "_", "7": "77", "_": "__", ":": "8", "8": "88"})
|
|
||||||
|
|
||||||
proc demanglePackageName*(path: string): string =
|
proc demanglePackageName*(path: string): string =
|
||||||
result = path.multiReplace(
|
result = path.multiReplace({"@@": "@", "@": "/"})
|
||||||
{"88": "8", "8": ":", "77": "7", "__": "_", "_7": "../", "7": "/"})
|
|
||||||
|
|
||||||
proc withPackageName*(conf: ConfigRef; path: AbsoluteFile): AbsoluteFile =
|
proc withPackageName*(conf: ConfigRef; path: AbsoluteFile): AbsoluteFile =
|
||||||
let x = getPackageName(conf, path.string)
|
let x = getPackageName(conf, path.string)
|
||||||
|
|
|
||||||
|
|
@ -332,8 +332,7 @@ proc generatedFile(test: TTest, target: TTarget): string =
|
||||||
else:
|
else:
|
||||||
let (_, name, _) = test.name.splitFile
|
let (_, name, _) = test.name.splitFile
|
||||||
let ext = targetToExt[target]
|
let ext = targetToExt[target]
|
||||||
result = nimcacheDir(test.name, test.options, target) /
|
result = nimcacheDir(test.name, test.options, target) / name.changeFileExt(ext)
|
||||||
name.replace("_", "__").changeFileExt(ext)
|
|
||||||
|
|
||||||
proc needsCodegenCheck(spec: TSpec): bool =
|
proc needsCodegenCheck(spec: TSpec): bool =
|
||||||
result = spec.maxCodeSize > 0 or spec.ccodeCheck.len > 0
|
result = spec.maxCodeSize > 0 or spec.ccodeCheck.len > 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue