* lib.scm: Import (test-suite paths).
authorJim Blandy <jimb@red-bean.com>
Tue, 15 Jun 1999 08:39:39 +0000 (08:39 +0000)
committerJim Blandy <jimb@red-bean.com>
Tue, 15 Jun 1999 08:39:39 +0000 (08:39 +0000)
(data-file): New exported function.

test-suite/lib.scm

index 87ab54d..bcf6bd4 100644 (file)
@@ -16,7 +16,8 @@
 ;;;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 ;;;; Boston, MA 02111-1307 USA
 
-(define-module (test-suite lib))
+(define-module (test-suite lib)
+  #:use-module (test-suite paths))
 
 (export
 
  make-log-reporter 
  full-reporter
  user-reporter
- format-test-name)
+ format-test-name
+
+ ;; Finding test input files.
+ data-file)
 
 
 ;;;; If you're using Emacs's Scheme mode:
 
 (define (pass-if name condition)
   ((if condition pass fail) name))
+
+\f
+;;;; Helping test cases find their files
+
+;;; Returns FILENAME, relative to the directory the test suite data
+;;; files were installed in, and makes sure the file exists.
+(define (data-file filename)
+  (let ((f (in-vicinity datadir filename)))
+    (or (file-exists? f)
+       (error "Test suite data file does not exist: " f))
+    f))