display-utils-test.scm 791 B

123456789101112131415161718192021222324252627282930313233
  1. (use-modules
  2. ;; SRFI 64 for unit testing facilities
  3. (srfi srfi-64)
  4. ;; utils - the code to be tested
  5. (utils display))
  6. (test-begin "display-utils-test")
  7. (test-group
  8. "displayln"
  9. ;; if this test fails, then the gini index of perfect split is not 0.0
  10. (test-equal "displayln with empty string should ee a newline"
  11. "\n"
  12. (call-with-output-string
  13. (lambda (port)
  14. (displayln "" port))))
  15. (test-equal "displayln with normal message"
  16. "Hello!\n"
  17. (call-with-output-string
  18. (lambda (port)
  19. (displayln "Hello!" port))))
  20. (test-equal "displayln with message ending on newline should have 2 newlines"
  21. "This is my message!\n\n"
  22. (call-with-output-string
  23. (lambda (port)
  24. (displayln "This is my message!\n" port)))))
  25. (test-end "display-utils-test")