Changeset 36545 in project


Ignore:
Timestamp:
09/08/18 11:48:20 (2 weeks ago)
Author:
sjamaan
Message:

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

File:
1 edited

Legend:

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

    r36537 r36545  
    128128    ))
    129129
     130(define ipv6-host-literal-cases
     131  ;; From #1530, found by Vasilij Schneidermann
     132  `(("http://[::1]:8080" "::1")
     133    ;; From RFC 2732
     134    ("http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html" "FEDC:BA98:7654:3210:FEDC:BA98:7654:3210")
     135    ("http://[1080:0:0:0:8:800:200C:417A]/index.html" "1080:0:0:0:8:800:200C:417A")
     136    ("http://[3ffe:2a00:100:7031::1]" "3ffe:2a00:100:7031::1")
     137    ("http://[1080::8:800:200C:417A]/foo" "1080::8:800:200C:417A")
     138    ("http://[::192.9.5.5]/ipng" "::192.9.5.5")
     139    ("http://[::FFFF:129.144.52.38]:80/index.html" "::FFFF:129.144.52.38")
     140    ("http://[2010:836B:4179::836B:4179]" "2010:836B:4179::836B:4179")
     141    ;; ipv-future examples
     142    ("http://[vA.123456:789]/" "vA.123456:789")
     143    ;; Currently unsupported: ipv6 addresses are expected to always
     144    ;; have a colon in them.
     145    ;;("http://[vA.123456]/" "vA.123456")
     146    ))
     147
    130148(define reverse-extra-cases
    131149  `((,base ,base "")
     
    142160    (,base "ftp://a/b/c/d;p?q" "ftp://a/b/c/d;p?q")
    143161    (,base "ftp://x/y/z;a?b" "ftp://x/y/z;a?b")))
     162
     163(test-group "ipv6 host literals"
     164  (for-each (lambda (p)
     165              (let ((uri (uri-reference (first p))))
     166                (test (apply sprintf "~S has host ~S" p)
     167                      (second p) (uri-host uri))
     168                (test-assert (sprintf "~S has an ipv6 host" (first p))
     169                             (uri-ipv6-host? uri))
     170                (test (sprintf "~S = ~S" (first p) (uri->string uri))
     171                      (uri->string uri) (first p))
     172                ))
     173            ipv6-host-literal-cases))
     174
     175(test-exit)
    144176
    145177(test-group "uri test"
     
    188220            extra-cases))
    189221
     222(test-group "ipv6 host literals"
     223  (for-each (lambda (p)
     224              (let ((uri (uri-reference (first p))))
     225                (test (apply sprintf "~S has host ~S" p)
     226                      (second p) (uri-host uri))
     227                (test-assert (sprintf "~S has an ipv6 host" (first p))
     228                             (uri-ipv6-host? uri))
     229                (test (sprintf "~S = ~S" (first p) (uri->string uri))
     230                      (uri->string uri) (first p))
     231                ))
     232            ipv6-host-literal-cases))
     233
    190234(test-group "reverse-extra-test"
    191235  (for-each (lambda (p)
     
    249293     ("//:123" "")
    250294     ;; Thanks to Roel van der Hoorn for finding this one
    251      ("//%20/" "%20")
    252      ;; From #1530, found by Vasilij Schneidermann
    253      ("http://[::1]:8080" "::1"))
     295     ("//%20/" "%20"))
    254296    ("ipv6-host?" ,uri-ipv6-host?
    255297     ("http://[::1]/bla" #t)
Note: See TracChangeset for help on using the changeset viewer.