From ef2677f5f3f58ad5bd514f82a0efd68d4d17e7f9 Mon Sep 17 00:00:00 2001 From: flywind <43030857+xflywind@users.noreply.github.com> Date: Thu, 12 Nov 2020 17:47:56 +0800 Subject: change some code-blocks to runnableExamples and correct some errors in docs (#15900) * original docs are wrong * fix pathnorm * Update lib/pure/pathnorm.nim Co-authored-by: Juan Carlos --- lib/pure/pathnorm.nim | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'lib/pure/pathnorm.nim') diff --git a/lib/pure/pathnorm.nim b/lib/pure/pathnorm.nim index 03a65bd60..5bc66f0b7 100644 --- a/lib/pure/pathnorm.nim +++ b/lib/pure/pathnorm.nim @@ -100,15 +100,13 @@ proc addNormalizePath*(x: string; result: var string; state: var int; if result == "" and x != "": result = "." proc normalizePath*(path: string; dirSep = DirSep): string = - ## Example: - ## - ## .. code-block:: nim - ## assert normalizePath("./foo//bar/../baz") == "foo/baz" - ## - ## + runnableExamples: + when defined(posix): + doAssert normalizePath("./foo//bar/../baz") == "foo/baz" + ## - Turns multiple slashes into single slashes. - ## - Resolves '/foo/../bar' to '/bar'. - ## - Removes './' from the path (but "foo/.." becomes ".") + ## - Resolves `'/foo/../bar'` to `'/bar'`. + ## - Removes `'./'` from the path, but `"foo/.."` becomes `"."`. result = newStringOfCap(path.len) var state = 0 addNormalizePath(path, result, state, dirSep) -- cgit 1.4.1-2-gfad0