Misc improvements to `net/uri-codec'.

Fix a bug in encoding strings with characters between 128 and 256, avoid
extra bindings for conversion vectors; remove calling `noels-tests' from
`main' since it's already called from `tests', etc.

original commit: c2280ed8dc
This commit is contained in:
Eli Barzilay 2013-05-19 03:45:01 -04:00
parent 71a343ca03
commit ea5ef3ff51
2 changed files with 3 additions and 5 deletions

View File

@ -19,7 +19,6 @@
do (dns:tests)
do (url:tests)
do (ucodec:tests)
do (ucodec:noels-tests)
do (cgi:tests)
do (ftp:tests)
do (head:tests)

View File

@ -69,12 +69,12 @@
(uri-userinfo-decode "hello") => "hello"
(uri-userinfo-decode "hello%20there") => "hello there"
(uri-userinfo-decode "hello:there") => "hello:there"
;; tried to choose characters from each subset:
(uri-encode "M~(@; ") => "M~(%40%3B%20"
(uri-path-segment-encode "M~(@; ") => "M~(@%3B%20"
(uri-userinfo-encode "M~(@; ") => "M~(%40;%20"
(uri-unreserved-encode "M~(@; ") => "M~%28%40%3B%20"
(uri-unreserved-encode "M~(@; ") => "M~%28%40%3B%20"
(uri-path-segment-unreserved-encode "M~(@; ") => "M~%28@%3B%20"
;; matching decodes:
(uri-decode "M~(%40%3B%20") => "M~(@; "
@ -85,11 +85,10 @@
(uri-path-segment-decode "M~%28@%3B%20") => "M~(@; "
(uri-path-segment-unreserved-decode "M~(@%3B%20") => "M~(@; "
(uri-encode "æçè") => "%C3%A6%C3%A7%C3%A8"
))
;; tests adapted from Noel Welsh's original test suite
(provide noels-tests)
(module+ main (noels-tests))
(define (noels-tests)
(define (pad2 str)
(if (= (string-length str) 1) (string-append "0" str) str))