modules.test 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ;;;; modules.test --- exercise some of guile's module stuff -*- scheme -*-
  2. ;;;; Copyright (C) 2006 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 2.1 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. (use-modules (test-suite lib))
  18. (with-test-prefix "autoload"
  19. (pass-if "autoloaded"
  20. (catch #t
  21. (lambda ()
  22. ;; Simple autoloading.
  23. (eval '(begin
  24. (define-module (test-autoload-one)
  25. :autoload (ice-9 q) (make-q))
  26. (not (not make-q)))
  27. (current-module)))
  28. (lambda (key . args)
  29. #f)))
  30. ;; In Guile 1.8.0 this failed because the binder in
  31. ;; `make-autoload-interface' would try to remove the autoload interface
  32. ;; from the module's "uses" without making sure it is still part of these
  33. ;; "uses".
  34. ;;
  35. (pass-if "autoloaded+used"
  36. (catch #t
  37. (lambda ()
  38. (eval '(begin
  39. (define-module (test-autoload-two)
  40. :autoload (ice-9 q) (make-q)
  41. :use-module (ice-9 q))
  42. (not (not make-q)))
  43. (current-module)))
  44. (lambda (key . args)
  45. #f))))