aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThomas Albers Raviola <thomas@thomaslabs.org>2024-10-18 19:34:44 +0200
committerThomas Albers Raviola <thomas@thomaslabs.org>2024-10-18 19:34:44 +0200
commite6b5011763c7f59ae8acf2c38d568c88ebd65ec1 (patch)
treeb0717a2af8366fe6849a4a7f28170d8f61bd9242 /tests
parent1be9ab5f5a929153b4a8193f6c12bab45fd00ab2 (diff)
Add test suit
Diffstat (limited to 'tests')
-rw-r--r--tests/package.lisp3
-rw-r--r--tests/test-routes.lisp25
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/package.lisp b/tests/package.lisp
new file mode 100644
index 0000000..eb337ea
--- /dev/null
+++ b/tests/package.lisp
@@ -0,0 +1,3 @@
+(defpackage #:scgi-routes/tests
+ (:use #:cl
+ #:scgi-routes))
diff --git a/tests/test-routes.lisp b/tests/test-routes.lisp
new file mode 100644
index 0000000..45f75cc
--- /dev/null
+++ b/tests/test-routes.lisp
@@ -0,0 +1,25 @@
+(in-package #:scgi-routes/tests)
+
+(5am:def-suite* scgi-routes-tests)
+
+(5am:test test1
+ (5am:finishes
+ (routes:define-route index (:path (p1 p2 "index.cgi")
+ :method :get
+ :query (q1
+ (q2 :init-form "2")
+ (q3 :name "named")
+ (q4 :name "all" :init-form "4"
+ :suppliedp q4p)
+ (q5 :suppliedp q5p))
+ :fragment f
+ :content-type "text/plain")
+ (list p1 p2 q1 q2 q3 q4 q4p q5 q5p f)))
+ (5am:is
+ (equal
+ (let (ret
+ (uri "http://localhost:8080/foo/blah/index.cgi?b=1&c=2&q5"))
+ (with-output-to-string (*standard-output*)
+ (setf ret (test-route :get uri)))
+ ret)
+ (list "foo" "blah" nil "2" nil "4" t nil t nil))))