Skip to content

Commit 775c22a

Browse files
committed
Add some basic, rudimentary tests
1 parent cbb2ff7 commit 775c22a

2 files changed

Lines changed: 38 additions & 1 deletion

File tree

ql-https.asd

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,23 @@
1818
(uiop:subpathname *load-pathname* "README.md"))
1919
:perform (load-op :after (o c)
2020
(uiop:symbol-call :ql-https :register-fetch-scheme-functions)
21-
(pushnew :ql-https *features*)))
21+
(pushnew :ql-https *features*))
22+
:in-order-to ((test-op (test-op "ql-https/test"))))
23+
24+
25+
(defsystem "ql-https/test"
26+
:description "Tests for ql-https"
27+
:depends-on ((:require "uiop")
28+
"fiasco"
29+
"ql-https")
30+
:pathname "t/"
31+
:components ((:file "tests"))
32+
:perform (test-op (op c)
33+
(unless (uiop:symbol-call :fiasco :run-package-tests :package :ql-https/test)
34+
#+(not (or :swank :slynk))
35+
(error "Tests failed."))))
36+
37+
38+
2239

2340

t/tests.lisp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
;;; This Source Code Form is subject to the terms of the Mozilla Public
2+
;;; License, v. 2.0. If a copy of the MPL was not distributed with this
3+
;;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
4+
5+
(fiasco:define-test-package :ql-https/test)
6+
(in-package #:ql-https/test)
7+
8+
(deftest test-ql-https-is-initialized-correctly ()
9+
(let ((http-function (cdr (assoc "http" ql-http:*fetch-scheme-functions* :test #'string=)))
10+
(https-function (cdr (assoc "https" ql-http:*fetch-scheme-functions* :test #'string=))))
11+
(is (eq 'ql-https:fetcher http-function) "HTTP doesn't use `ql-https:fetch'")
12+
(is (eq 'ql-https:fetcher https-function) "HTTP doesn't use `ql-https:fetch'")))
13+
14+
(deftest test-downloading-system ()
15+
(let ((ql-https:*quietly-use-https* nil))
16+
(signals ql-https:no-https-error
17+
(ql:quickload "str" :silent t))))
18+
19+
20+

0 commit comments

Comments
 (0)