interp.test 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. ;;;; interp.test --- tests for bugs in the Guile interpreter -*- scheme -*-
  2. ;;;;
  3. ;;;; Copyright (C) 1999 Free Software Foundation, Inc.
  4. ;;;;
  5. ;;;; This program is free software; you can redistribute it and/or modify
  6. ;;;; it under the terms of the GNU General Public License as published by
  7. ;;;; the Free Software Foundation; either version 2, or (at your option)
  8. ;;;; any later version.
  9. ;;;;
  10. ;;;; This program is distributed in the hope that it will be useful,
  11. ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ;;;; GNU General Public License for more details.
  14. ;;;;
  15. ;;;; You should have received a copy of the GNU General Public License
  16. ;;;; along with this software; see the file COPYING. If not, write to
  17. ;;;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  18. ;;;; Boston, MA 02111-1307 USA
  19. (pass-if "Internal defines 1"
  20. (letrec ((foo (lambda (arg)
  21. (or arg (and (procedure? foo)
  22. (foo 99))))))
  23. (define bar (foo #f))
  24. (foo #f)))
  25. (pass-if "Internal defines 2"
  26. (letrec ((foo 77)
  27. (bar #f)
  28. (retfoo (lambda () foo)))
  29. (define baz (retfoo))
  30. (retfoo)))
  31. ;; Test that evaluation of closure bodies works as it should
  32. (with-test-prefix "closure bodies"
  33. (with-test-prefix "eval"
  34. (pass-if "expansion"
  35. ;; we really want exactly #f back from the closure
  36. (not ((lambda () (define ret #f) ret))))
  37. (pass-if "iloc escape"
  38. (not (let* ((x #f)
  39. (foo (lambda () x)))
  40. (foo) ; causes memoization of x
  41. (foo)))))
  42. (with-test-prefix "apply"
  43. (pass-if "expansion"
  44. (not (catch #t (lambda () (define ret #f) ret) (lambda a #t))))
  45. (pass-if "iloc escape"
  46. (not (let* ((x #f)
  47. (foo (lambda () x)))
  48. (foo)
  49. (catch #t foo (lambda a #t)))))))