tstaticlib.nim 648 B

1234567891011121314151617181920212223
  1. import std/[os, osproc, strformat]
  2. const dir = "tests/compiles"
  3. const fileName = dir / "mstaticlib.nim"
  4. const nim = getCurrentCompilerExe()
  5. block: # bug #18578
  6. const libName = dir / "tstaticlib1.a"
  7. let (_, status) = execCmdEx(fmt"{nim} c -o:{libName} --app:staticlib {fileName}")
  8. doAssert status == 0
  9. doAssert fileExists(libName)
  10. removeFile(libName)
  11. block: # bug #16947
  12. const libName = dir / "tstaticlib2.a"
  13. writeFile(libName, "echo 124")
  14. doAssert fileExists(libName)
  15. let (_, status) = execCmdEx(fmt"{nim} c -o:{libName} --app:staticlib {fileName}")
  16. doAssert status == 0
  17. doAssert fileExists(libName)
  18. removeFile(libName)