enable experimental:strictDefs (#24225)

This commit is contained in:
ringabout
2024-11-24 05:01:39 +08:00
committed by GitHub
parent 555191a3f0
commit 2df633180a
86 changed files with 276 additions and 255 deletions

View File

@@ -38,6 +38,7 @@ proc splitTestFile*(file: string): tuple[cat: string, path: string] =
## At least one directory is required in the path, to use as a category name
runnableExamples:
doAssert splitTestFile("tests/fakedir/tfakename.nim") == ("fakedir", "tests/fakedir/tfakename.nim".unixToNativePath)
result = ("", "")
for p in file.parentDirs(inclusive = false):
let parent = p.parentDir
if parent.lastPathPart == testsFname:

View File

@@ -6,13 +6,18 @@ proc mismatch*[T](lhs: T, rhs: T): string =
## while avoiding pulling too many dependencies. On failure, diagnostic
## information is provided that in particular makes it easy to spot
## whitespace mismatches and where the mismatch is.
result = ""
proc replaceInvisible(s: string): string =
result = ""
for a in s:
case a
of '\n': result.add "\\n\n"
else: result.add a
proc quoted(s: string): string = result.addQuoted s
proc quoted(s: string): string =
result = ""
result.addQuoted s
result.add '\n'
result.add "lhs:{" & replaceInvisible(