eval-string.test 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. ;;;; eval-string.test --- tests for (ice-9 eval-string) -*- scheme -*-
  2. ;;;; Copyright (C) 2011 Free Software Foundation, Inc.
  3. ;;;;
  4. ;;;; This library is free software; you can redistribute it and/or
  5. ;;;; modify it under the terms of the GNU Lesser General Public
  6. ;;;; License as published by the Free Software Foundation; either
  7. ;;;; version 3 of the License, or (at your option) any later version.
  8. ;;;;
  9. ;;;; This library is distributed in the hope that it will be useful,
  10. ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. ;;;; Lesser General Public License for more details.
  13. ;;;;
  14. ;;;; You should have received a copy of the GNU Lesser General Public
  15. ;;;; License along with this library; if not, write to the Free Software
  16. ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. (define-module (test-suite test-eval-string)
  18. #:use-module (test-suite lib)
  19. #:use-module (ice-9 eval-string))
  20. (with-test-prefix "basic"
  21. (pass-if "eval none"
  22. (equal? (eval-string "") *unspecified*))
  23. (pass-if "eval single"
  24. (equal? (eval-string "'foo") 'foo))
  25. (pass-if "eval multiple"
  26. (equal? (eval-string "'foo 'bar") 'bar))
  27. (pass-if "compile none"
  28. (equal? (eval-string "" #:compile? #t) *unspecified*))
  29. (pass-if "compile single"
  30. (equal? (eval-string "'foo" #:compile? #t)
  31. 'foo))
  32. (pass-if "compile multiple"
  33. (equal? (eval-string "'foo 'bar" #:compile? #t)
  34. 'bar))
  35. (pass-if "eval values"
  36. (equal? (call-with-values (lambda ()
  37. (eval-string "(values 1 2)"))
  38. list)
  39. '(1 2)))
  40. (pass-if "compile values"
  41. (equal? (call-with-values (lambda ()
  42. (eval-string "(values 1 2)" #:compile? #t))
  43. list)
  44. '(1 2))))