Changeset 25789 in project for release


Ignore:
Timestamp:
01/08/12 13:48:51 (10 years ago)
Author:
sjamaan
Message:

uri-generic: Add some basic testcases for make-uri and get rid of error when no path is provided

Location:
release/4/uri-generic/trunk
Files:
2 edited

Legend:

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

    r20988 r25789  
    549549            rfc5122-refs))
    550550
     551(define make-cases
     552  `(("http://example.com:123/foo/bar?a=b;c=d#location"
     553     scheme: http host: "example.com" port: 123 path: (/ "foo" "bar")
     554     query: "a=b;c=d" fragment: "location")
     555    ("//example.com:123/foo/bar?a=b;c=d#location"
     556     host: "example.com" port: 123 path: (/ "foo" "bar")
     557     query: "a=b;c=d" fragment: "location")
     558    ("/foo/bar?a=b;c=d#location"
     559     port: 123 path: (/ "foo" "bar") query: "a=b;c=d" fragment: "location")
     560    ("foo/bar?a=b;c=d#location"
     561     path: ("foo" "bar") query: "a=b;c=d" fragment: "location")
     562    ("/?a=b;c=d#location"
     563     path: (/ "") query: "a=b;c=d" fragment: "location")
     564    ("?a=b;c=d#location"
     565     query: "a=b;c=d" fragment: "location")
     566    ("#location"
     567     fragment: "location")
     568    ("//example.com?a=b;c=d"
     569     host: "example.com" query: "a=b;c=d")
     570    ("//example.com#location"
     571     host: "example.com" fragment: "location")
     572    ("/"
     573     path: (/ ""))
     574    ("/"
     575     path: (/))                         ; Not sure if this works by accident
     576    (""
     577     path: ())
     578    ("")))
     579
     580(test-group "manual constructor"
     581  (for-each (lambda (u)
     582              (let* ((input (cdr u))
     583                     (oexp (first u))
     584                     (oact (apply make-uri input)))
     585                (test (sprintf "~S -> ~S" input oexp)
     586                      oexp (uri->string oact))))
     587            make-cases))
     588
    551589(test-end "uri-generic")
    552590
  • release/4/uri-generic/trunk/uri-generic.scm

    r25287 r25789  
    44;; Based on the Haskell URI library by  Graham Klyne <gk@ninebynine.org>.
    55;;
    6 ;; Copyright 2008-2011 Ivan Raikov, Peter Bex.
     6;; Copyright 2008-2012 Ivan Raikov, Peter Bex.
    77;;
    88;;
     
    136136
    137137(define (make-uri . key/values)
    138   (apply update-uri (make-URI) key/values))
     138  (apply update-uri (make-URI path: '()) key/values))
    139139
    140140;; Character classes
Note: See TracChangeset for help on using the changeset viewer.