aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLars Ingebrigtsen2018-05-01 14:26:27 +0200
committerLars Ingebrigtsen2018-05-01 14:26:38 +0200
commite859acb11cacd0c661b730d43151f77281e17d7d (patch)
treeeec19287beb514c9a923febd835b46d671257d0b /test
parent539f5889207157ddd864f228b126197573404dd9 (diff)
downloademacs-e859acb11cacd0c661b730d43151f77281e17d7d.tar.gz
emacs-e859acb11cacd0c661b730d43151f77281e17d7d.zip
Rewrite `url-domain' to avoid network traffic
* lisp/url/url-util.el (url-domain): Don't talk DNS to determine the domain, because this is slow. * test/lisp/url/url-util-tests.el (url-domain-tests): Add tests for `url-domain'.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/url/url-util-tests.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/lisp/url/url-util-tests.el b/test/lisp/url/url-util-tests.el
index ee97d97dd34..2e2875a196b 100644
--- a/test/lisp/url/url-util-tests.el
+++ b/test/lisp/url/url-util-tests.el
@@ -46,6 +46,18 @@
46 ("key2" "val2") 46 ("key2" "val2")
47 ("key1" "val1"))))) 47 ("key1" "val1")))))
48 48
49(ert-deftest url-domain-tests ()
50 (should (equal (url-domain (url-generic-parse-url "http://www.fsf.co.uk"))
51 "fsf.co.uk"))
52 (should (equal (url-domain (url-generic-parse-url "http://fsf.co.uk"))
53 "fsf.co.uk"))
54 (should (equal (url-domain (url-generic-parse-url "http://co.uk"))
55 nil))
56 (should (equal (url-domain (url-generic-parse-url "http://www.fsf.com"))
57 "fsf.com"))
58 (should (equal (url-domain (url-generic-parse-url "http://192.168.0.1"))
59 nil)))
60
49(provide 'url-util-tests) 61(provide 'url-util-tests)
50 62
51;;; url-util-tests.el ends here 63;;; url-util-tests.el ends here