From 3379e2c4499bf3ca82de7043337e416ef15d24ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 28 Jun 2022 09:33:08 +0200 Subject: Various test cleanups. --- tests/test/add-and-save.scm | 2 ++ tests/test/annoying-events.scm | 1 + tests/test/param.scm | 4 ++++ tests/test/recurrence-advanced.scm | 8 ++++---- tests/test/recurrence-simple.scm | 2 ++ tests/test/server.scm | 16 ++++++++++------ tests/test/web-query.scm | 4 ---- 7 files changed, 23 insertions(+), 14 deletions(-) diff --git a/tests/test/add-and-save.scm b/tests/test/add-and-save.scm index b58a6f06..1ab6f660 100644 --- a/tests/test/add-and-save.scm +++ b/tests/test/add-and-save.scm @@ -14,6 +14,8 @@ remove-event ))) +;; TODO is this how I want to format direct components? + (define timezone '(vtimezone (properties (tzid (text "Europe/Stockholm"))) diff --git a/tests/test/annoying-events.scm b/tests/test/annoying-events.scm index 4570a5a6..673a4b49 100644 --- a/tests/test/annoying-events.scm +++ b/tests/test/annoying-events.scm @@ -14,6 +14,7 @@ :use-module ((datetime) :select (date date+ date<)) :use-module ((hnh util) :select (set!))) +;; TODO remove this (define* (event key: summary dtstart dtend) (define ev (make-vcomponent 'VEVENT)) (set! (prop ev 'SUMMARY) diff --git a/tests/test/param.scm b/tests/test/param.scm index 4c3cbcfb..34f7b826 100644 --- a/tests/test/param.scm +++ b/tests/test/param.scm @@ -18,6 +18,10 @@ :select (vcomponent->sxcal)) ) +;; TODO clean up this whole test + +;; TODO possibly change parsing + (define v (call-with-input-string "BEGIN:DUMMY diff --git a/tests/test/recurrence-advanced.scm b/tests/test/recurrence-advanced.scm index a68a53b1..a291cc17 100644 --- a/tests/test/recurrence-advanced.scm +++ b/tests/test/recurrence-advanced.scm @@ -34,20 +34,20 @@ :use-module ((srfi srfi-41) :select (stream->list)) :use-module ((srfi srfi-88) :select (keyword->string))) -(test-expect-fail "RSET: The third instance into the month of one of Tuesday, Wednesday, or Thursday, for the next 3 months") +(test-expect-fail "REC: The third instance into the month of one of Tuesday, Wednesday, or Thursday, for the next 3 months") (test-expect-fail "STR: The third instance into the month of one of Tuesday, Wednesday, or Thursday, for the next 3 months") -(test-expect-fail "RSET: The second-to-last weekday of the month") +(test-expect-fail "REC: The second-to-last weekday of the month") (test-expect-fail "STR: The second-to-last weekday of the month") ;; TODO this test is really slow, figure out why (takes approx. 25s to run) -(test-skip "RSET: Every day in January, for 3 years (alt 2)") +(test-skip "REC: Every day in January, for 3 years (alt 2)") (define (run-test comp) (test-equal - (string-append "RSET: " (prop comp 'SUMMARY)) + (string-append "REC: " (prop comp 'SUMMARY)) (prop comp 'X-SET) (let ((r (generate-recurrence-set comp))) (map (extract 'DTSTART) diff --git a/tests/test/recurrence-simple.scm b/tests/test/recurrence-simple.scm index 3ddcb5ad..bf154fea 100644 --- a/tests/test/recurrence-simple.scm +++ b/tests/test/recurrence-simple.scm @@ -23,6 +23,8 @@ make-recur-rule generate-recurrence-set))) +;; TODO evaluate format for direct events + ;;; Test that basic parsing or recurrence rules work. (test-equal (make-recur-rule freq: 'HOURLY wkst: mon interval: 1) diff --git a/tests/test/server.scm b/tests/test/server.scm index 43b60769..a6200cb8 100644 --- a/tests/test/server.scm +++ b/tests/test/server.scm @@ -13,12 +13,16 @@ (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)) +(test-group + "Simple parameters" + (let ((path args (parse-endpoint-string "/static/:dir/:file"))) + (test-equal "Path" "/static/([^/.]+)/([^/.]+)" path) + (test-equal "Parameters" '(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)) +(test-group + "Custom regex for parameters" + (let ((path args (parse-endpoint-string "/static/:filename{.*}.:ext"))) + (test-equal "Path" "/static/(.*)\\.([^/.]+)" path) + (test-equal "Parameters" '(filename ext) args))) diff --git a/tests/test/web-query.scm b/tests/test/web-query.scm index 76c0a76d..0555258b 100644 --- a/tests/test/web-query.scm +++ b/tests/test/web-query.scm @@ -3,8 +3,6 @@ :use-module (srfi srfi-88) :use-module ((web query) :select (parse-query))) -(test-begin "Web Query") - (test-equal "Empty query gives empty assoc list" '() (parse-query "")) (test-equal "Simple key-value query" @@ -34,5 +32,3 @@ ;; I don't know if HTTP allows this, but my code works like this (test-equal "Value with equal in it" '(key: "=") (parse-query "key==")) - -(test-end "Web Query") -- cgit v1.2.3