]> git.donarmstrong.com Git - lilypond.git/blobdiff - guile18/test-suite/tests/modules.test
Import guile-1.8 as multiple upstream tarball component
[lilypond.git] / guile18 / test-suite / tests / modules.test
diff --git a/guile18/test-suite/tests/modules.test b/guile18/test-suite/tests/modules.test
new file mode 100644 (file)
index 0000000..9541f06
--- /dev/null
@@ -0,0 +1,50 @@
+;;;; modules.test --- exercise some of guile's module stuff -*- scheme -*-
+
+;;;; Copyright (C) 2006 Free Software Foundation, Inc.
+;;;;
+;;;; This library is free software; you can redistribute it and/or
+;;;; modify it under the terms of the GNU Lesser General Public
+;;;; License as published by the Free Software Foundation; either
+;;;; version 2.1 of the License, or (at your option) any later version.
+;;;;
+;;;; This library is distributed in the hope that it will be useful,
+;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;;;; Lesser General Public License for more details.
+;;;;
+;;;; You should have received a copy of the GNU Lesser General Public
+;;;; License along with this library; if not, write to the Free Software
+;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+(use-modules (test-suite lib))
+
+(with-test-prefix "autoload"
+
+  (pass-if "autoloaded"
+     (catch #t
+       (lambda ()
+        ;; Simple autoloading.
+        (eval '(begin
+                 (define-module (test-autoload-one)
+                   :autoload (ice-9 q) (make-q))
+                 (not (not make-q)))
+              (current-module)))
+       (lambda (key . args)
+         #f)))
+
+  ;; In Guile 1.8.0 this failed because the binder in
+  ;; `make-autoload-interface' would try to remove the autoload interface
+  ;; from the module's "uses" without making sure it is still part of these
+  ;; "uses".
+  ;;
+  (pass-if "autoloaded+used"
+     (catch #t
+       (lambda ()
+        (eval '(begin
+                 (define-module (test-autoload-two)
+                   :autoload (ice-9 q) (make-q)
+                   :use-module (ice-9 q))
+                 (not (not make-q)))
+              (current-module)))
+       (lambda (key . args)
+         #f))))