aboutsummaryrefslogtreecommitdiff
path: root/tests/server.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-01-13 22:50:51 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2021-01-13 22:50:51 +0100
commit641278c624a3a0c06856656255f648f2cf4f6a92 (patch)
tree49c47c4c61dd0704e89cfd75681bc16f171e7ad5 /tests/server.scm
parentAdd debug buttons in popup for dumping xcal and jcal. (diff)
parentDocument (vcompenent control). (diff)
downloadcalp-641278c624a3a0c06856656255f648f2cf4f6a92.tar.gz
calp-641278c624a3a0c06856656255f648f2cf4f6a92.tar.xz
Merge branch 'doc' into jcal
Diffstat (limited to 'tests/server.scm')
-rw-r--r--tests/server.scm23
1 files changed, 19 insertions, 4 deletions
diff --git a/tests/server.scm b/tests/server.scm
index a9cb870e..706697f6 100644
--- a/tests/server.scm
+++ b/tests/server.scm
@@ -1,6 +1,21 @@
-(((web http make-routes) parse-endpoint-string))
+;;; Commentary:
+;; 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))