From 5c58bcbd372ec69d2245962e614bb90947e28760 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Tue, 19 Dec 2023 15:52:11 +0100 Subject: Test the values of %current-path and %current-path-string. --- tests/guile/cantius-test.scm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'tests') 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 -- cgit v1.2.3