test-system-cmds 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/sh
  2. exec guile -q -s "$0" "$@"
  3. !#
  4. (define (test-system-cmd)
  5. (if (not (boolean? (system)))
  6. (begin
  7. (simple-format
  8. #t
  9. "test-system-cmds: (system) did not return a boolean\n")
  10. (exit 1)))
  11. ;; Note: Use double quotes since simple quotes are not supported by
  12. ;; `cmd.exe' on Windows.
  13. (let ((rs (status:exit-val (system "guile -c \"(exit 42)\""))))
  14. (if (not (= 42 rs))
  15. (begin
  16. (simple-format
  17. #t
  18. "test-system-cmds: system exit status was ~S rather than 42\n"
  19. rs)
  20. (exit 1)))))
  21. (define (test-system*-cmd)
  22. (let ((rs (status:exit-val (system* "guile" "-c" "(exit 42)"))))
  23. (if (not (= 42 rs))
  24. (begin
  25. (simple-format
  26. #t
  27. "test-system-cmds: system* exit status was ~S rather than 42\n"
  28. rs)
  29. (exit 1)))))
  30. (if (defined? 'system)
  31. (test-system-cmd))
  32. (if (defined? 'system*)
  33. (test-system*-cmd))
  34. (exit 0)
  35. ;; Local Variables:
  36. ;; mode: scheme
  37. ;; End: