aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2023-12-19 15:52:11 +0100
committerWojtek Kosior <koszko@koszko.org>2023-12-19 15:52:11 +0100
commit5c58bcbd372ec69d2245962e614bb90947e28760 (patch)
tree3218605f6d22299d6943569f139068218a29c4ec /tests
parentd8776e1ca00711b4153a827ed604eba55f7cd62b (diff)
downloadcantius-5c58bcbd372ec69d2245962e614bb90947e28760.tar.gz
cantius-5c58bcbd372ec69d2245962e614bb90947e28760.zip
Test the values of %current-path and %current-path-string.
Diffstat (limited to 'tests')
-rw-r--r--tests/guile/cantius-test.scm13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/guile/cantius-test.scm b/tests/guile/cantius-test.scm
index f3e628a..04176f9 100644
--- a/tests/guile/cantius-test.scm
+++ b/tests/guile/cantius-test.scm
@@ -6,6 +6,7 @@
((srfi srfi-26) #:select (cut))
((srfi srfi-34) #:select (guard raise))
((ice-9 safe-r5rs) #:select (null-environment))
+ ((ice-9 format) #:select (format))
((web client) #:select (open-socket-for-uri http-get))
((web response) #:prefix rsp:)
((web uri) #:prefix uri:)
@@ -36,6 +37,7 @@
#:use-module ((srfi srfi-18) #:select
(make-thread thread-terminate! thread-yield!
thread-start!))
+ #:use-module ((ice-9 format) #:select (format))
#:use-module (cantius))
(define sock-port
@@ -59,7 +61,10 @@
(define-endpoint %my-endset drm-wiki
("drm-wiki" ,(string-append "dev" "ices") . some-path) '()
(values (build-response*)
- (string-join (cons "page for:" some-path))))
+ (format #f "~@{~@?~%~^~}"
+ "full page path1: ~a" (%current-path-string)
+ "full page path2: ~{/~a~}" (%current-path)
+ "device page path: ~{/~a~}" some-path)))
(define-endpoint %my-endset about-google
,(list "cool-companies" "google" "about")
@@ -145,7 +150,11 @@
(define ipad-result
(get "/drm-wiki/devices/apple/ipad"))
- (tu:test-equal "page for: apple ipad" (cadr ipad-result)))
+ (tu:test-equal (format #f "~@{~a~%~}"
+ "full page path1: /drm-wiki/devices/apple/ipad"
+ "full page path2: /drm-wiki/devices/apple/ipad"
+ "device page path: /apple/ipad")
+ (cadr ipad-result)))
(tu:test-group "about-google"
(define google-result