summaryrefslogtreecommitdiff
path: root/test/src/process-tests.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2019-08-23 04:49:52 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2019-08-23 04:49:52 +0200
commit53cb3d3e0ddb666dc5b7774957ca863c668213cb (patch)
tree011cf32acf25b0cd86debf5b3c22be289e60bd87 /test/src/process-tests.el
parentb4d3a882a8423e81c418fc56b7a9677f5582fcc7 (diff)
parent29d485fb768fbe375d60fd80cb2dbdbd90f3becc (diff)
downloademacs-53cb3d3e0ddb666dc5b7774957ca863c668213cb.tar.gz
emacs-53cb3d3e0ddb666dc5b7774957ca863c668213cb.tar.bz2
emacs-53cb3d3e0ddb666dc5b7774957ca863c668213cb.zip
Merge remote-tracking branch 'origin/netsec'
Diffstat (limited to 'test/src/process-tests.el')
-rw-r--r--test/src/process-tests.el29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/src/process-tests.el b/test/src/process-tests.el
index 7745fccaf9d..724da1c3e72 100644
--- a/test/src/process-tests.el
+++ b/test/src/process-tests.el
@@ -22,6 +22,7 @@
;;; Code:
(require 'ert)
+(require 'puny)
;; Timeout in seconds; the test fails if the timeout is reached.
(defvar process-test-sentinel-wait-timeout 2.0)
@@ -322,5 +323,33 @@ See Bug#30460."
invocation-directory))
:stop t)))
+(ert-deftest lookup-family-specification ()
+ "network-lookup-address-info should only accept valid family symbols."
+ (should-error (network-lookup-address-info "google.com" 'both))
+ (should (network-lookup-address-info "google.com" 'ipv4))
+ (should (network-lookup-address-info "google.com" 'ipv6)))
+
+(ert-deftest lookup-unicode-domains ()
+ "Unicode domains should fail"
+ (should-error (network-lookup-address-info "faß.de"))
+ (should (length (network-lookup-address-info (puny-encode-domain "faß.de")))))
+
+(ert-deftest unibyte-domain-name ()
+ "Unibyte domain names should work"
+ (should (length (network-lookup-address-info (string-to-unibyte "google.com")))))
+
+(ert-deftest lookup-google ()
+ "Check that we can look up google IP addresses"
+ (let ((addresses-both (network-lookup-address-info "google.com"))
+ (addresses-v4 (network-lookup-address-info "google.com" 'ipv4))
+ (addresses-v6 (network-lookup-address-info "google.com" 'ipv6)))
+ (should (length addresses-both))
+ (should (length addresses-v4))
+ (should (length addresses-v6))))
+
+(ert-deftest non-existent-lookup-failure ()
+ "Check that looking up non-existent domain returns nil"
+ (should (eq nil (network-lookup-address-info "emacs.invalid"))))
+
(provide 'process-tests)
;; process-tests.el ends here.