test-module-pathnames.script 2.11 KB
Newer Older
1
;;; -*- Lisp -*-
2

3
4
5
6
7
8
9
10
11
12
(def-test-system :test-module-pathnames
  :pathname #.*test-directory*
  :components
  ((:module "sources/level1"
    :serial t
    :components
    ((:file "file1")
     (:file "level2/file2")
     (:static-file "level2/static.file")
     (:static-file "test-tmp.cl")))))
13

14
(DBG "Loading the system")
15
(asdf:load-system 'test-module-pathnames)
16
17

(DBG "Checking pathnames")
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
(flet ((pathname-foo (x)
         (list (or (normalize-pathname-directory-component (pathname-directory x)) '(:relative))
               (pathname-name x) (pathname-type x))))
  (let* ((static (find-component "test-module-pathnames" '("sources/level1" "level2/static.file")))
         (test-tmp (find-component "test-module-pathnames" '("sources/level1" "test-tmp.cl"))))
    (assert-equal (pathname-foo (asdf:component-relative-pathname test-tmp))
                  '((:relative) "test-tmp" "cl"))
    (assert-equal (pathname-foo (asdf:component-relative-pathname static))
                  '((:relative "level2") "static" "file"))))
(assert (find-package :test-package)
        () "package test-package not found")
(assert (find-symbol (symbol-name '*file-tmp*) :test-package)
        () "symbol `*file-tmp*` not found")
(assert (symbol-value (find-symbol (symbol-name '*file-tmp*) :test-package))
        () "symbol `*file-tmp*` has wrong value")
33

34
35
36
37
38
39
40
41
42
(assert (probe-file
         (apply-output-translations
          (merge-pathnames*
           (make-pathname*
            :name "file1"
            :type (compile-file-type)
            :directory '(:relative "sources" "level1"))
           *test-directory*)))
        () "compiled file not found")
43

44
45
46
47
(assert (find-symbol (symbol-name '*file-tmp2*) :test-package)
        () "symbol `*file-tmp2*` not found")
(assert (symbol-value (find-symbol (symbol-name '*file-tmp2*) :test-package))
        () "symbol `*file-tmp2*` has wrong value")
48

49
50
51
52
53
54
55
56
(assert (probe-file
         (apply-output-translations
          (merge-pathnames*
           (make-pathname*
            :name "file2"
            :type (compile-file-type)
            :directory '(:relative "sources" "level1" "level2")))))
        nil "compiled file not found")