Changeset 36546 in project


Ignore:
Timestamp:
09/08/18 11:49:11 (12 days ago)
Author:
sjamaan
Message:

uri-generic: Add several URI samples with ipv6 hosts literals and one ipvfuture host literal to test suite (C5)

File:
1 edited

Legend:

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

    r36538 r36546  
    126126    ))
    127127
     128(define ipv6-host-literal-cases
     129  ;; From #1530, found by Vasilij Schneidermann
     130  `(("http://[::1]:8080" "::1")
     131    ;; From RFC 2732
     132    ("http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html" "FEDC:BA98:7654:3210:FEDC:BA98:7654:3210")
     133    ("http://[1080:0:0:0:8:800:200C:417A]/index.html" "1080:0:0:0:8:800:200C:417A")
     134    ("http://[3ffe:2a00:100:7031::1]" "3ffe:2a00:100:7031::1")
     135    ("http://[1080::8:800:200C:417A]/foo" "1080::8:800:200C:417A")
     136    ("http://[::192.9.5.5]/ipng" "::192.9.5.5")
     137    ("http://[::FFFF:129.144.52.38]:80/index.html" "::FFFF:129.144.52.38")
     138    ("http://[2010:836B:4179::836B:4179]" "2010:836B:4179::836B:4179")
     139    ;; ipv-future examples
     140    ("http://[vA.123456:789]/" "vA.123456:789")
     141    ;; Currently unsupported: ipv6 addresses are expected to always
     142    ;; have a colon in them.
     143    ;;("http://[vA.123456]/" "vA.123456")
     144    ))
     145
    128146(define reverse-extra-cases
    129147  `((,base ,base "")
     
    140158    (,base "ftp://a/b/c/d;p?q" "ftp://a/b/c/d;p?q")
    141159    (,base "ftp://x/y/z;a?b" "ftp://x/y/z;a?b")))
     160
     161(test-group "ipv6 host literals"
     162  (for-each (lambda (p)
     163              (let ((uri (uri-reference (first p))))
     164                (test (apply sprintf "~S has host ~S" p)
     165                      (second p) (uri-host uri))
     166                (test-assert (sprintf "~S has an ipv6 host" (first p))
     167                             (uri-ipv6-host? uri))
     168                (test (sprintf "~S = ~S" (first p) (uri->string uri))
     169                      (uri->string uri) (first p))
     170                ))
     171            ipv6-host-literal-cases))
     172
     173(test-exit)
    142174
    143175(test-group "uri test"
     
    186218            extra-cases))
    187219
     220(test-group "ipv6 host literals"
     221  (for-each (lambda (p)
     222              (let ((uri (uri-reference (first p))))
     223                (test (apply sprintf "~S has host ~S" p)
     224                      (second p) (uri-host uri))
     225                (test-assert (sprintf "~S has an ipv6 host" (first p))
     226                             (uri-ipv6-host? uri))
     227                (test (sprintf "~S = ~S" (first p) (uri->string uri))
     228                      (uri->string uri) (first p))
     229                ))
     230            ipv6-host-literal-cases))
     231
    188232(test-group "reverse-extra-test"
    189233  (for-each (lambda (p)
     
    247291     ("//:123" "")
    248292     ;; Thanks to Roel van der Hoorn for finding this one
    249      ("//%20/" "%20")
    250      ;; From #1530, found by Vasilij Schneidermann
    251      ("http://[::1]:8080" "::1"))
     293     ("//%20/" "%20"))
    252294    ("ipv6-host?" ,uri-ipv6-host?
    253295     ("http://[::1]/bla" #t)
Note: See TracChangeset for help on using the changeset viewer.