|
5 | 5 | (fiasco:define-test-package :ql-https/test) |
6 | 6 | (in-package #:ql-https/test) |
7 | 7 |
|
| 8 | +(defmacro wait ((&key (timeout 10)) &body body) |
| 9 | + (let ((gthread (gensym "thread"))) |
| 10 | + `(let ((,gthread (sb-thread:make-thread (lambda () |
| 11 | + (progn ,@body))))) |
| 12 | + (sb-thread:join-thread ,gthread :timeout ,timeout)))) |
| 13 | + |
8 | 14 | (deftest test-ql-https-is-initialized-correctly () |
9 | 15 | (let ((http-function (cdr (assoc "http" ql-http:*fetch-scheme-functions* :test #'string=))) |
10 | 16 | (https-function (cdr (assoc "https" ql-http:*fetch-scheme-functions* :test #'string=)))) |
11 | 17 | (is (eq 'ql-https:fetcher http-function) "HTTP doesn't use `ql-https:fetch'") |
12 | 18 | (is (eq 'ql-https:fetcher https-function) "HTTP doesn't use `ql-https:fetch'"))) |
13 | 19 |
|
14 | 20 | (deftest test-downloading-system () |
| 21 | + (ql:uninstall "str") |
15 | 22 | (let ((ql-https:*quietly-use-https* nil)) |
16 | 23 | (signals ql-https:no-https-error |
17 | | - (ql:quickload "str" :silent t)))) |
| 24 | + (ql:quickload "str" :silent t)))) |
18 | 25 |
|
19 | 26 | (deftest test-quicklisp-download () |
20 | | - (let ((ql-https:*quietly-use-https* t)) |
21 | | - (ql:quickload "str" :silent t)) |
22 | | - (is (probe-file (merge-pathnames "quicklisp/dists/quicklisp/installed/systems/str.txt" |
23 | | - (user-homedir-pathname))))) |
| 27 | + (ql:uninstall "str") |
| 28 | + (wait () |
| 29 | + (let ((ql-https:*quietly-use-https* t)) |
| 30 | + (ql:quickload "str" :silent t))) |
| 31 | + (is (find-package :str))) |
24 | 32 |
|
25 | 33 | (deftest test-ultralisp-download () |
26 | | - ;; install ultralisp |
27 | | - (ql-dist:install-dist "https://dist.ultralisp.org/") |
28 | | - (let ((ql-https:*quietly-use-https* t)) |
29 | | - (ql:quickload "hyperdoc" :silent t)) |
30 | | - (is (probe-file (merge-pathnames "quicklisp/dists/ultralisp/installed/systems/hyperdoc.txt")))) |
| 34 | + (ql:uninstall "hyperdoc") |
| 35 | + (wait () |
| 36 | + (let ((ql-https:*quietly-use-https* t)) |
| 37 | + ;; install ultralisp |
| 38 | + (ql-dist:install-dist "https://dist.ultralisp.org/" :prompt nil :replace t) |
| 39 | + (ql:quickload "hyperdoc" :silent t))) |
| 40 | + (is (find-package :hyperdoc))) |
31 | 41 |
|
32 | 42 |
|
33 | 43 |
|
0 commit comments