blob: 2e36ba3102d9851f617d5a4af55bf5070940856c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
;;; Weeb --- Web microframework for GNU Guile
;;; Copyright © 2026 Jakob Kreuze <zerodaysfordays@sdf.org>
;;;
;;; This file is part of Weeb.
;;;
;;; Weeb is free software: you can redistribute it and/or modify it
;;; under the terms of the GNU Affero General Public License as
;;; published by the Free Software Foundation, either version 3 of the
;;; License, or (at your option) any later version.
;;;
;;; Weeb is distributed in the hope that it will be useful, but WITHOUT
;;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
;;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General
;;; Public License for more details.
;;;
;;; You should have received a copy of the GNU Affero General Public
;;; License along with Weeb. If not, see <https://www.gnu.org/licenses/>.
(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