diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2018-05-01 14:26:27 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2018-05-01 14:26:38 +0200 |
commit | e859acb11cacd0c661b730d43151f77281e17d7d (patch) | |
tree | eec19287beb514c9a923febd835b46d671257d0b /test/lisp/url | |
parent | 539f5889207157ddd864f228b126197573404dd9 (diff) | |
download | emacs-e859acb11cacd0c661b730d43151f77281e17d7d.tar.gz emacs-e859acb11cacd0c661b730d43151f77281e17d7d.tar.bz2 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/lisp/url')
-rw-r--r-- | test/lisp/url/url-util-tests.el | 12 |
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 @@ ("key2" "val2") ("key1" "val1"))))) +(ert-deftest url-domain-tests () + (should (equal (url-domain (url-generic-parse-url "http://www.fsf.co.uk")) + "fsf.co.uk")) + (should (equal (url-domain (url-generic-parse-url "http://fsf.co.uk")) + "fsf.co.uk")) + (should (equal (url-domain (url-generic-parse-url "http://co.uk")) + nil)) + (should (equal (url-domain (url-generic-parse-url "http://www.fsf.com")) + "fsf.com")) + (should (equal (url-domain (url-generic-parse-url "http://192.168.0.1")) + nil))) + (provide 'url-util-tests) ;;; url-util-tests.el ends here |