diff options
Diffstat (limited to 'tests/guile/cantius-test.scm')
-rw-r--r-- | tests/guile/cantius-test.scm | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/guile/cantius-test.scm b/tests/guile/cantius-test.scm index 3591b64..c00977c 100644 --- a/tests/guile/cantius-test.scm +++ b/tests/guile/cantius-test.scm @@ -111,6 +111,30 @@ value %form-boundary-1 (bv:string->utf8 %form-data-unsupported-encoding)))) +(tu:test-group "parse-cookies" + (tu:test-equal '(("name" . "val")) + (cant:parse-cookies "name=val;")) + + (tu:test-equal '(("ses sion" . "fargtrg34") + ("s" . "f") + ("forms-session2" . "") + ("forms-sessio n3" . "f4 3433=g = 4")) + (cant:parse-cookies + (string-append "\t\tses sion =fargtrg34;" + " s = f;" + "forms-session2=\n;" + " forms-sessio n3=f4 3433=g = 4"))) + + (tu:test-equal '() (cant:parse-cookies "")) + + (for-each (lambda (bad-cookies) + (tu:test-error (cut condition-has-type? <> cant:&bad-request) + (cant:parse-cookies bad-cookies))) + '(";" + "c1=v1;c2=v2;c3;c4=v4" + "something" + "k=v;;"))) + (define (make-env) (let ((env (null-environment 5))) (module-use! env (resolve-interface '(guile))) |