summaryrefslogtreecommitdiffstats
path: root/tests/019
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-04-25 07:28:10 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-04-25 07:28:10 -0700
commit751728562ff124ede3386c26925fa06edc8862fd (patch)
tree86a3a4901545f5b792a6f7e261f59e2d35bc7fb9 /tests/019
parente3a06759eebdc2b4e2d0b8d08cb64eb99a40d3e3 (diff)
downloadtxr-751728562ff124ede3386c26925fa06edc8862fd.tar.gz
txr-751728562ff124ede3386c26925fa06edc8862fd.tar.bz2
txr-751728562ff124ede3386c26925fa06edc8862fd.zip
*load-search-dir*: Some tests.
* tests/019/load-search.tl: Add some cases that explore the load search path.
Diffstat (limited to 'tests/019')
-rw-r--r--tests/019/load-search.tl33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/019/load-search.tl b/tests/019/load-search.tl
index 962f8bc7..985bcbd0 100644
--- a/tests/019/load-search.tl
+++ b/tests/019/load-search.tl
@@ -5,6 +5,10 @@
(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"
@@ -34,3 +38,32 @@
(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)