emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 6c3bafbc2c 2/3: Add tests for url-{hexify,unhex}-string


From: Stefan Kangas
Subject: master 6c3bafbc2c 2/3: Add tests for url-{hexify,unhex}-string
Date: Tue, 2 Aug 2022 04:22:18 -0400 (EDT)

branch: master
commit 6c3bafbc2cf9853f3082fb643ee20c78a80bb69e
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    Add tests for url-{hexify,unhex}-string
    
    * test/lisp/url/url-util-tests.el (url-unhex-string-tests)
    (url-hexify-string-tests): New tests.
---
 test/lisp/url/url-util-tests.el | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/test/lisp/url/url-util-tests.el b/test/lisp/url/url-util-tests.el
index 8c042c0135..cfc2d93c89 100644
--- a/test/lisp/url/url-util-tests.el
+++ b/test/lisp/url/url-util-tests.el
@@ -46,6 +46,26 @@
                    ("key2" "val2")
                    ("key1" "val1")))))
 
+(ert-deftest url-unhex-string-tests ()
+  (should (equal (url-unhex-string "foo%20bar")
+                 "foo bar"))
+  (should (equal (decode-coding-string (url-unhex-string "Fran%C3%A7ois") 
'utf-8)
+                 "Fran├žois"))
+  (should (equal (url-unhex-string "%20%21%23%24%25%26%27%28%29%2A")
+                 " !#$%&'()*"))
+  (should (equal (url-unhex-string "%2B%2C%2F%3A%3B%3D%3F%40%5B%5D")
+                 "+,/:;=?@[]")))
+
+(ert-deftest url-hexify-string-tests ()
+  (should (equal (url-hexify-string "foo bar")
+                 "foo%20bar"))
+  (should (equal (url-hexify-string "Fran├žois")
+                 "Fran%C3%A7ois"))
+  (should (equal (url-hexify-string " !#$%&'()*")
+                 "%20%21%23%24%25%26%27%28%29%2A"))
+  (should (equal (url-hexify-string "+,/:;=?@[]")
+                 "%2B%2C%2F%3A%3B%3D%3F%40%5B%5D")))
+
 (ert-deftest url-domain-tests ()
   (should (equal (url-domain (url-generic-parse-url "http://www.fsf.co.uk";))
                  "fsf.co.uk"))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]