mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
* stdlib tests now check refc too * typo * fixes line numbers * disable cpp * do not touch
37 lines
1011 B
Nim
37 lines
1011 B
Nim
discard """
|
|
matrix: "--mm:refc; --mm:orc"
|
|
"""
|
|
|
|
import std/os
|
|
import std/assertions
|
|
|
|
when doslikeFileSystem:
|
|
import std/pathnorm
|
|
|
|
template initVars =
|
|
var state {.inject.} = 0
|
|
var result {.inject.}: string
|
|
|
|
block: # / -> /
|
|
initVars
|
|
addNormalizePath("//?/c:/./foo//bar/../baz", result, state, '/')
|
|
doAssert result == "//?/c:/foo/baz"
|
|
addNormalizePath("me", result, state, '/')
|
|
doAssert result == "//?/c:/foo/baz/me"
|
|
|
|
block: # / -> \
|
|
initVars
|
|
addNormalizePath(r"//?/c:/./foo//bar/../baz", result, state, '\\')
|
|
doAssert result == r"\\?\c:\foo\baz"
|
|
addNormalizePath("me", result, state, '\\')
|
|
doAssert result == r"\\?\c:\foo\baz\me"
|
|
|
|
block: # Append path component to UNC drive
|
|
initVars
|
|
addNormalizePath(r"//?/c:", result, state, '\\')
|
|
doAssert result == r"\\?\c:"
|
|
addNormalizePath("Users", result, state, '\\')
|
|
doAssert result == r"\\?\c:\Users"
|
|
addNormalizePath("me", result, state, '\\')
|
|
doAssert result == r"\\?\c:\Users\me"
|