tfoo.nims 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. mode = ScriptMode.Whatif
  2. exec "gcc -v"
  3. # test that ospaths actually compiles:
  4. import ospaths
  5. --forceBuild
  6. --path: "../friends"
  7. warning("uninit", off)
  8. hint("processing", off)
  9. #--verbosity:2
  10. patchFile("stdlib", "math", "mymath")
  11. task listDirs, "lists every subdirectory":
  12. for x in listDirs("."):
  13. echo "DIR ", x
  14. task default, "default target":
  15. --define: definedefine
  16. setCommand "c"
  17. # bug #6327
  18. doAssert(existsEnv("dummy") == false)
  19. # issue #7283
  20. putEnv("dummy", "myval")
  21. doAssert(existsEnv("dummy") == true)
  22. doAssert(getEnv("dummy") == "myval")
  23. # issue #7393
  24. let wd = getCurrentDir()
  25. cd("..")
  26. assert wd != getCurrentDir()
  27. cd(wd)
  28. assert wd == getCurrentDir()
  29. when false:
  30. # this doesn't work in a 'koch testintall' environment
  31. assert findExe("nim") != ""
  32. # general tests
  33. mode = ScriptMode.Verbose
  34. assert getCommand() == "c"
  35. setCommand("cpp")
  36. assert getCommand() == "cpp"
  37. setCommand("c")
  38. assert cmpic("HeLLO", "hello") == 0
  39. assert fileExists("tests/newconfig/tfoo.nims") == true
  40. assert dirExists("tests") == true
  41. assert existsFile("tests/newconfig/tfoo.nims") == true
  42. assert existsDir("tests") == true
  43. discard selfExe()
  44. when defined(windows):
  45. assert toExe("nim") == "nim.exe"
  46. assert toDll("nim") == "nim.dll"
  47. else:
  48. assert toExe("nim") == "nim"
  49. assert toDll("nim") == "libnim.so"
  50. rmDir("tempXYZ")
  51. assert dirExists("tempXYZ") == false
  52. mkDir("tempXYZ")
  53. assert dirExists("tempXYZ") == true
  54. assert fileExists("tempXYZ/koch.nim") == false
  55. when false:
  56. # this doesn't work in a 'koch testintall' environment
  57. cpFile("koch.nim", "tempXYZ/koch.nim")
  58. assert fileExists("tempXYZ/koch.nim") == true
  59. cpDir("nimsuggest", "tempXYZ/.")
  60. assert dirExists("tempXYZ/tests") == true
  61. assert fileExists("tempXYZ/nimsuggest.nim") == true
  62. rmFile("tempXYZ/koch.nim")
  63. assert fileExists("tempXYZ/koch.nim") == false
  64. rmDir("tempXYZ")
  65. assert dirExists("tempXYZ") == false