summaryrefslogtreecommitdiffstats
path: root/tests/019/load-search.tl
blob: 985bcbd0cf2e707ab48a9bc499130c03a785237c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
(load "../common")

(defvarl cur (dir-name *load-path*))

(defun txr (. args)
  (command-get-string `@{txr-exe-path} @{args " "}`))

(defun lod (x)
  (with-out-string-stream (*stdout*)
    (load x)))

(mtest
  (txr `@cur/data/a`)     "a\n"
  (txr `@cur/data/a.txr`) "a.txr\n"
  (txr `@cur/data/a.tl`)  "a.tl\n"
  (txr `@cur/data/a.tlo`) "a.tlo\n")

(mtest
  (txr `@cur/data/b`)     "b.txr\n"
  (txr `@cur/data/b.txr`) "b.txr\n"
  (txr `@cur/data/b.tl`)  "b.tl\n"
  (txr `@cur/data/b.tlo`) "b.tlo\n")

(mtest
  (txr `@cur/data/c`)     "c.txr\n"
  (txr `@cur/data/c.txr`) "c.txr\n"
  (txr `@cur/data/c.tl`)  "c.tl\n")

(let ((*stderr* *stdnull*))
  (mtest
    (txr "--lisp" `@cur/data/a`)      ""
    (txr "--compiled" `@cur/data/a`)  ""))

(mtest
  (txr "--lisp" `@cur/data/b`)      "b.tlo\n"
  (txr "--compiled" `@cur/data/b`)  "b.tlo\n")

(mtest
  (txr "--lisp" `@cur/data/c`)      "c.tl\n"
  (txr "--compiled" `@cur/data/c`)  "c.tl\n")

(mtest
  (length *load-search-dirs*) 1
  (base-name (car *load-search-dirs*)) "lib")

(set *load-search-dirs* (list `@cur/data`))

(mtest
  (lod "a")     :error
  (lod "a.tl")  "a.tl\n"
  (lod "c")     "c.tl\n")

(push `@cur/nonexistent` *load-search-dirs*)

(mtest
  (lod "a")     :error
  (lod "a.tl")  "a.tl\n"
  (lod "c")     "c.tl\n")

(push `@cur/unreadable` *load-search-dirs*)

(push-after-load (rmdir `@cur/unreadable`))

(ensure-dir `@cur/unreadable` 0)

(mtest
  (lod "a")     :error
  (lod "a.tl")  :error
  (lod "c")     :error)