0.6.9.10:
[sbcl.git] / tests / side-effectful-pathnames.test.sh
1 #!/bin/sh
2
3 # LOADing and COMPILEing files with logical pathnames
4 testdir=`pwd`"/side-effectful-pathnames-test-$$"
5 testfilestem="load-test"
6 StudlyCapsStem="Load-Test"
7 testfilename="$testdir/$testfilestem.lisp"
8 mkdir $testdir
9 cat >$testfilename <<EOF
10   (in-package :cl-user)
11   (defparameter *loaded* :yes)
12 EOF
13 sbcl --noinform --noprint --sysinit /dev/null --userinit /dev/null <<EOF
14   (in-package :cl-user)
15   (setf (logical-pathname-translations "TEST")
16         (list (list "**;*.*.*" "$testdir/**/*.*")))
17   (format t "/translations=~S~%" (logical-pathname-translations "TEST"))
18   (let* ((untranslated "test:$StudlyCapsStem.lisp")
19          (ignore-me (format t "untranslated=~S~%" untranslated))
20          (translation (namestring (translate-logical-pathname untranslated)))
21          (expected-translation "$testdir/$testfilestem.lisp"))
22     (format t "translation=~S~%" translation)
23     (format t "expected-translation=~S~%" expected-translation)
24     (assert (string= translation expected-translation)))
25   (load "TEST:$StudlyCapsStem")
26   (assert (eq *loaded* :yes))
27   (let ((compiled-file-name (namestring (compile-file "TEST:$StudlyCapsStem")))
28         (expected-file-name "$testdir/$testfilestem.x86f"))
29     (format t "compiled-file-name=~S~%" compiled-file-name)
30     (format t "expected-file-name=~S~%" expected-file-name)
31     (assert (string= compiled-file-name expected-file-name)))
32   (sb-ext:quit :unix-status 52)
33 EOF
34 if [ $? != 52 ]; then
35     echo test failed: $?
36     exit 1
37 fi
38 rm -r $testdir
39
40 # success
41 exit 104