source: project/release/4/spiffy-request-vars/trunk/tests/client.scm @ 18153

Last change on this file since 18153 was 18153, checked in by Mario Domenech Goulart, 11 years ago

spiffy-request-vars (trunk): added tests directory

  • Property svn:executable set to *
File size: 1.0 KB
Line 
1#!/usr/bin/csi -script
2
3(use test http-client)
4
5(define (get path/vars)
6  (with-input-from-request
7   (string-append "http://localhost:8080" path/vars)
8   #f read))
9
10;;; Strings
11(test #f (get "/as-string"))
12
13(test "a" (get "/as-string?var=a"))
14
15(test "a" (get "/as-string?var=a;var=b"))
16
17
18;;; Numbers
19(test 3 (get "/as-number?var=3"))
20
21(test #f (get "/as-number?foo=3"))
22
23
24;;; Booleans
25(test #f (get "/as-boolean"))
26
27(test #t (get "/as-boolean?var=yes"))
28
29
30;;; List
31(test '("a" "b")
32      (get "/as-list?var=a;var=b"))
33
34(test '("c")
35      (get "/as-list?var=c"))
36
37(test #f
38      (get "/as-list"))
39
40;;; Vectors
41(test '#("a" "b")
42      (get "/as-vector?var.0=a;var.1=b"))
43
44(test #f
45      (get "/as-vector?var=c"))
46
47(test '#("a" "b")
48      (get "/as-vector?var.0=a;var.1=b"))
49
50;;; Alists
51(test '((A . "a") (B . "b"))
52      (get "/as-alist?var.A=a;var.B=b"))
53
54(test #f
55      (get "/as-alist?var=c"))
56
57
58;;; Hash-tables
59(test '((B . "b") (A . "a"))
60      (get "/as-hash-table?var.A=a;var.B=b"))
61
62(test #f
63      (get "/as-hash-table?var=c"))
Note: See TracBrowser for help on using the repository browser.