Changeset 12582 in project for release/4/uri-generic/trunk/tests


Ignore:
Timestamp:
11/23/08 23:16:02 (12 years ago)
Author:
sjamaan
Message:

Add update-uri and update-auth procedures, change representation of query lists, fix a few small bugs discovered by adding more testcases

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/uri-generic/trunk/tests/run.scm

    r12363 r12582  
    11(require-extension srfi-1)
    2 (require-extension uri-generic)
     2(load "../uri-generic.scm")
     3(import uri-generic)
    34(require-extension test)
    45
     
    99100    (,base "" "http://a/b/c/d;p?q")
    100101    ("" ,base "http://a/b/c/d;p?q")
     102    (,base "http:" "http:")
    101103    ))
    102104
     
    164166                  (test (sprintf "~S -> ~S" (second p) expected) expected decoded)))
    165167            encode/decode-cases))
     168
     169(define update-cases
     170  '(("/foo" (path: ("/bar")) "/bar")
     171    ("/foo" (host: "localhost") "//localhost/foo")
     172    ("http://foo" (query: ((a . "b") (c . #t) (d . "e"))) "http://foo?a=b&c&d=e")
     173    ("http://foo" (host: #f) "http:")
     174    ("http://foo" (authority: #f) "http:")))
     175
     176(test-group "update-uri test"
     177  (for-each (lambda (p)
     178              (let ((expected (uri-reference (third p)))
     179                    (updated (apply update-uri (uri-reference (first p)) (second p))))
     180                  (test (sprintf "~S * ~S -> ~S" (first p) (second p) (third p)) expected updated)))
     181            update-cases))
Note: See TracChangeset for help on using the changeset viewer.