GOOPS cosmetics
[bpt/guile.git] / test-suite / tests / load.test
index 6b0de76..1cf8d65 100644 (file)
@@ -1,24 +1,26 @@
 ;;;; load.test --- test LOAD and path searching functions  -*- scheme -*-
 ;;;; Jim Blandy <jimb@red-bean.com> --- September 1999
 ;;;;
-;;;;   Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+;;;;   Copyright (C) 1999, 2001, 2006, 2010, 2012 Free Software Foundation, Inc.
 ;;;; 
-;;;; This program is free software; you can redistribute it and/or modify
-;;;; it under the terms of the GNU General Public License as published by
-;;;; the Free Software Foundation; either version 2, or (at your option)
-;;;; any later version.
+;;;; 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 3 of the License, or (at your option) any later version.
 ;;;; 
-;;;; This program is distributed in the hope that it will be useful,
+;;;; 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 General Public License for more details.
+;;;; 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 General Public License
-;;;; along with this software; see the file COPYING.  If not, write to
-;;;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
-;;;; Boston, MA 02111-1307 USA
+;;;; 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))
+(define-module (test-suite test-load)
+  #:use-module (test-suite lib)
+  #:use-module (test-suite guile-test)
+  #:use-module (system base compile))
 
 (define temp-dir (data-file-name "load-test.dir"))
 
 (try-search-with-extensions path "ugly.scm" extensions "dir3/ugly.scm")
 (try-search-with-extensions path "ugly.ss"  extensions #f)
 
-(if (defined? '%nil)
-    ;; Check that search-path accepts Elisp nil-terminated lists for
-    ;; PATH and EXTENSIONS.
-    (with-test-prefix "elisp-nil"
-      (set-cdr! (last-pair path) %nil)
-      (set-cdr! (last-pair extensions) %nil)
-      (try-search-with-extensions path "ugly.scm" extensions "dir3/ugly.scm")
-      (try-search-with-extensions path "ugly.ss"  extensions #f)))
+;; Check that search-path accepts Elisp nil-terminated lists for
+;; PATH and EXTENSIONS.
+(with-test-prefix "elisp-nil"
+  (set-cdr! (last-pair path) 
+#nil)
+  (set-cdr! (last-pair extensions) #nil)
+  (try-search-with-extensions path "ugly.scm" extensions "dir3/ugly.scm")
+  (try-search-with-extensions path "ugly.ss"  extensions #f))
       
+(with-test-prefix "return value of `load'"
+  (let ((temp-file (in-vicinity temp-dir "foo.scm")))
+    (call-with-output-file temp-file
+      (lambda (port)
+        (write '(+ 2 3) port)
+        (newline port)))
+    (pass-if "primitive-load"
+      (equal? 5 (primitive-load temp-file)))
+    (let ((temp-compiled-file (in-vicinity temp-dir "foo.go")))
+      (compile-file temp-file #:output-file temp-compiled-file)
+      (pass-if "load-compiled"
+        (equal? 5 (load-compiled temp-compiled-file))))))
+
 (delete-tree temp-dir)