tfoo.nims 1.9 KB

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