mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 01:14:41 +00:00
* make more standard libraries work with `nimPreviewSlimSystem` * typo * part two * Delete specutils.nim * fixes more tests * more fixes * fixes tests * fixes three more tests * add formatfloat import * fix * last
36 lines
979 B
Nim
36 lines
979 B
Nim
discard """
|
|
"""
|
|
|
|
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"
|