aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJakob L. Kreuze2026-07-11 14:13:01 -0400
committerJakob L. Kreuze2026-07-11 16:40:36 -0400
commitaccdc69892dec21502f70c50f98e998730f20ee8 (patch)
treece46aa9d6753674d17dfcce90a984f216e898652 /tests
parent5ba75e77c2b7769c700261e21ca7ab968e7f1960 (diff)
Response objects
Diffstat (limited to 'tests')
-rw-r--r--tests/response.scm20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/response.scm b/tests/response.scm
new file mode 100644
index 0000000..e382169
--- /dev/null
+++ b/tests/response.scm
@@ -0,0 +1,20 @@
+(use-modules (srfi srfi-64)
+ (weeb response)
+ (weeb struct))
+
+(test-runner-current (test-runner-simple))
+
+(test-begin "weeb-response")
+
+(test-group "any->response"
+ (let ((resp (make-struct <response> 201 '() "created")))
+ (test-equal "identity" resp (any->response resp)))
+ (test-equal "string-only" (make-struct <response> 200 '() "hello")
+ (any->response "hello"))
+ (test-equal "list" (make-struct <response> 404 '() "not found")
+ (any->response '(404 "not found")))
+ (test-error "integer should trigger error" #t (any->response 500))
+ (test-error "list too short" #t (any->response '(200)))
+ (test-error "list too long" #t (any->response '(200 "body" "extra"))))
+
+(test-end)

© 2015 - 2026 Jakob L. Kreuze