/red-system/tests/source/units/make-lib-auto-test.r

http://github.com/dockimbel/Red · R · 51 lines · 37 code · 14 blank · 0 comment · 0 complexity · 8e2ae08a3ae8858b7bdc052eff6bba04 MD5 · raw file

  1. REBOL [
  2. Title: "Generates Red/System lib tests"
  3. Author: "Peter W A Wood"
  4. File: %make-lib-auto-test.r
  5. Version: 0.1.1
  6. Rights: "Copyright (C) 2011 Peter W A Wood. All rights reserved."
  7. License: "BSD-3 - https://github.com/dockimbel/Red/blob/origin/BSD-3-License.txt"
  8. ]
  9. ;; initialisations
  10. make-dir %auto-tests/
  11. file-out: %auto-tests/lib-auto-test.reds
  12. file-in: %lib-test-source.reds
  13. ;; get base dir address
  14. base-dir: to-local-file system/script/path
  15. ;; work out prefix and extension based on version
  16. switch/default fourth system/version [
  17. 2 [
  18. abs-path: join "" [base-dir "/libs/"]
  19. prefix: "lib"
  20. ext: ".dylib"
  21. ]
  22. 3 [
  23. abs-path: join "" [base-dir "\libs\"]
  24. prefix: ""
  25. ext: ".dll"
  26. ]
  27. ][ ;; default to libxxx.so
  28. abs-path: join "" [base-dir "/libs/"]
  29. prefix: "lib"
  30. ext: ".so"
  31. ]
  32. ;; read the file, insert the absolute path and file prefix and extension
  33. src: read file-in
  34. replace/all src "***abs-path***" abs-path
  35. replace/all src "###prefix###" prefix
  36. replace/all src "@@@extension@@@" ext
  37. write file-out src