Changeset 20462 in project


Ignore:
Timestamp:
09/23/10 19:30:50 (8 years ago)
Author:
sjamaan
Message:

Implement fix for #396 (preserve empty path components), and add regression tests for this. The code change itself is a pure reversal of [12721]. I also added test-begin and test-end so we get a complete summary at the end (which saves us from visually scanning the test output of the individual test groups)

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

Legend:

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

    r20461 r20462  
    44(require-extension test)
    55
     6(test-begin "uri-generic")
     7
    68(define  path-cases
    7   ;; test cases from Python URI implementation
    8   '(("foo:xyz" "bar:abc" "bar:abc")
     9  '(;; test cases from Python URI implementation
     10    ("foo:xyz" "bar:abc" "bar:abc")
    911    ("http://example/x/y/z" "http://example/x/abc" "../abc")
    1012    ("http://example2/x/y/z" "http://example/x/abc" "//example/x/abc")
     
    108110    ("http://a/b//c///d///" "..//.." "http://a/b/")
    109111    ("http://a" "b" "http://a/b") ; RFC3986, section 5.2.3, first bullet point
     112   
     113    ;; Empty segments are segments nonetheless, so should be treated as such
     114    ;; [http://bugs.call-cc.org/ticket/396]
     115    ("http://a//b//c" "../../../.." "http://a/")
    110116    ))
    111117
     
    253259     ("foo/bar%2Fqux" ("foo" "bar/qux"))
    254260     ("foo/" ("foo" ""))
     261     
     262     ;; Empty path components preserved?  [http://bugs.call-cc.org/ticket/396]
     263     ("/foo//bar" (/ "foo" "" "bar"))
     264     ("/foo///bar" (/ "foo" "" "" "bar"))
     265     ("foo//bar" ("foo" "" "bar"))
     266     ("foo///bar" ("foo" "" "" "bar"))
     267     
    255268     ("foo/bar:qux" ("foo" "bar:qux"))
    256269     ("/foo%2Fbar" (/ "foo/bar"))
     
    407420  ;; Special case, see section 4.2
    408421  (test "./foo:bar" (uri->string (update-uri (uri-reference "") path: '("foo:bar")))))
     422
     423(test-end "uri-generic")
  • release/4/uri-generic/trunk/uri-generic.scm

    r16923 r20462  
    610610  (match s
    611611         ((#\/ . rst)
    612           (or (slash-segment rst)
    613               (match (segment rst)
    614                      ((ss rst)  (list ss rst))
    615                      (else #f))))
     612          (match (segment rst)
     613            ((ss rst)  (list ss rst))
     614            (else #f)))
    616615         (else  #f)))
    617616
Note: See TracChangeset for help on using the changeset viewer.