Merge pull request #2 from Ferada/punycode
[puri-unicode.git] / tests.lisp
index b5cbe37..fe9eda7 100644 (file)
                     (parse-uri "ftp://parcftp.xerox.com:/pub/pcl/mop/"))
             :test 'string=)
           res)
+    (push `(test
+            "http://xn--mller-kva.example.com/"
+            (format nil "~a"
+                    (parse-uri "http://xn--mller-kva.example.com/"))
+            :test 'string=)
+          res)
+    (push `(test
+            "http://xn--mller-kva.example.com/"
+            (format nil "~a"
+                    (parse-uri "http://müller.example.com/"))
+            :test 'string=)
+          res)
+    (push `(test
+            "http://example.xn--fiqz9s/"
+            (format nil "~a"
+                    (parse-uri "http://example.中國/"))
+            :test 'string=)
+          res)
 
 ;;;; enough-uri tests
     (dolist (x `(("http://www.franz.com/foo/bar/baz.htm"
        :condition-type 'uri-parse-error)
      res)
 
+    ;;; tests for weird control characters
+    ;; http://www.ietf.org/rfc/rfc2396.txt 2.4.3
+    (dolist (x '("https://example.com/q?foo%0abar%20baz" ;;an escaped newline
+                "https://example.com/q?%7f" ;; 7f, 127
+                ))
+      (push
+       `(let ((weird-uri ,x))
+         (test weird-uri
+               (puri:render-uri (puri:parse-uri weird-uri) nil)
+               :test #'string=)
+         ) res))
+
     `(progn ,@(nreverse res))))
 
 (defun do-tests ()