aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-01-13 22:43:45 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2021-01-13 22:49:05 +0100
commite53a507fd464d0dba069b193027d891bd3da61b2 (patch)
treefc9fcd4ed1d737abb5cd8c84522a79b887a2466e
parentClarify event-length/clamped test. (diff)
downloadcalp-e53a507fd464d0dba069b193027d891bd3da61b2.tar.gz
calp-e53a507fd464d0dba069b193027d891bd3da61b2.tar.xz
Add additional parse-endpoint-string tests.
-rw-r--r--tests/server.scm19
1 files changed, 16 insertions, 3 deletions
diff --git a/tests/server.scm b/tests/server.scm
index 0efd63d0..706697f6 100644
--- a/tests/server.scm
+++ b/tests/server.scm
@@ -2,7 +2,20 @@
;; Tests parse-endpoint-string, used for defining server routes.
;;; Code:
-(test-assert (parse-endpoint-string "/static/:dir/:file"))
-;; => "/static/([^/]+)/([^/]+)"
-;; => (dir file)
+(((web http make-routes) parse-endpoint-string)
+ ((calp util) let*))
+(test-assert "Check that parsing doesn't crash"
+ (parse-endpoint-string "/static/:dir/:file"))
+
+;; Checks that parsing produces correct results
+(let* ((path args (parse-endpoint-string "/static/:dir/:file")))
+ (test-equal "/static/([^/]+)/([^/]+)" path)
+ (test-equal '(dir file) args))
+
+
+;; Checks that parsing with custom regex works
+;; along with literal periods.
+(let* ((path args (parse-endpoint-string "/static/:filename{.*}.:ext")))
+ (test-equal "/static/(.*)\\.([^/.]+)" path)
+ (test-equal '(filename ext) args))