test.scm 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. ; -*- mode: scheme; coding: utf-8 -*-
  2. ; Test reader extension for raw strings
  3. (import (raw-strings) (srfi srfi-26) (srfi srfi-64))
  4. (define (test-reader s)
  5. (call-with-input-string s
  6. (cute (@@ (raw-strings) reader-extension-raw-string) #\R <>)))
  7. (test-begin "raw-strings")
  8. (test-error 'raw-string-delimiter-not-found (test-reader "xxx||"))
  9. (test-error 'end-of-file-reading-raw-string (test-reader "xxx(thest|\"ring)xx"))
  10. (test-equal "thest|\"ring" (test-reader "xxx(thest|\"ring)xxx"))
  11. (test-equal "thestring)xxyTHENMORE" (test-reader "xxx(thestring)xxyTHENMORE)xxx"))
  12. (test-equal "zeroprefix" (test-reader "(zeroprefix)"))
  13. (test-equal "thest|\\\"ring" #Rxxx(thest|\"ring)xxx)
  14. (test-equal "thestring)xxyTHENMORE" #Rxxx(thestring)xxyTHENMORE)xxx)
  15. (test-equal "zero(\\prefix" #R(zero(\prefix))
  16. (test-equal "hello" #R"hello")
  17. (test-equal "(hello)" #R"(hello)")
  18. (test-equal "\"hello\"" #R("hello"))
  19. (test-equal "(hello)" #R[(hello)])
  20. (test-equal #R-"he-""- "he-\"")
  21. (test-equal #R-(he-))- "he-)")
  22. (test-equal #R-(he-)))- "he-))")
  23. (test-equal #R-(he-()- "he-(")
  24. (test-equal #R***"he***"**"*** "he***\"**")
  25. (test-equal #R***"he***""*** "he***\"")
  26. #R-(This is a long string,
  27. full of bad stuff like \ ' " \" \n ) ( etc.
  28. that finally ends.)-
  29. #R-"This is a long string,
  30. full of bad stuff like \ ' " \" \n ) ( etc.
  31. that finally ends."-
  32. (define error-count (test-runner-fail-count (test-runner-current)))
  33. (test-end "raw-strings")
  34. (exit error-count)