Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheecour committed Feb 3, 2021
1 parent 6f0f5b3 commit 26ca9ef
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/misc/tcross_compilation.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
discard """
cmd: "nim $target --os:windows --compileonly $file"
action: compile
disabled: windows # so that test runs on posix host but windows target
"""

# xxx add a way to test this at RT to make sure windows semantics are used.

import os, strutils

proc main() =
doAssert not defined(posix)
doAssert defined(windows)
doAssert "foo" / "bar" == "foo/bar"
const s = currentSourcePath
doAssert '\\' notin s
doAssert '/' in s
doAssert DirSep == '/'
let s2 = currentSourcePath
doAssert s2 == s
let s3 = s2.parentDir / "baz"
doAssert s3.endsWith "tests/misc/baz"
doAssert s3.isAbsolute

static: main()
main()
# the doAsserts inside here would need to be adjusted, this is just used
# to make sure it compiles without `static`

0 comments on commit 26ca9ef

Please sign in to comment.