diff options
| author | Robert Pluim | 2019-11-18 11:07:51 +0100 |
|---|---|---|
| committer | Robert Pluim | 2019-11-29 16:41:04 +0100 |
| commit | 6d8e758e85d0662775b27111289aa199e0d0a46f (patch) | |
| tree | d4f1f1dd5f4f6eb5a02a775869eaa62cc52bbc44 | |
| parent | 8400766b43ef83768b05e71f13c79ea237e21ca8 (diff) | |
| download | emacs-6d8e758e85d0662775b27111289aa199e0d0a46f.tar.gz emacs-6d8e758e85d0662775b27111289aa199e0d0a46f.zip | |
Add nsm-should-check IPv6 local subnet tests
* test/lisp/net/nsm-tests.el (nsm-check-local-subnet-ipv6): Now
that IPv6 addresses are returned from network-interface-list, test
nsm-should check and nsm-network-same-subnet for IPv6 as well.
| -rw-r--r-- | test/lisp/net/nsm-tests.el | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/test/lisp/net/nsm-tests.el b/test/lisp/net/nsm-tests.el index f3544370389..97edcca80de 100644 --- a/test/lisp/net/nsm-tests.el +++ b/test/lisp/net/nsm-tests.el | |||
| @@ -49,9 +49,6 @@ | |||
| 49 | (should (eq nil (nsm-should-check "127.0.0.1"))) | 49 | (should (eq nil (nsm-should-check "127.0.0.1"))) |
| 50 | (should (eq nil (nsm-should-check "localhost")))))) | 50 | (should (eq nil (nsm-should-check "localhost")))))) |
| 51 | 51 | ||
| 52 | ;; FIXME This will never return true, since | ||
| 53 | ;; network-interface-list only gives the primary address of each | ||
| 54 | ;; interface, which will be the IPv4 one | ||
| 55 | (defun nsm-ipv6-is-available () | 52 | (defun nsm-ipv6-is-available () |
| 56 | (and (featurep 'make-network-process '(:family ipv6)) | 53 | (and (featurep 'make-network-process '(:family ipv6)) |
| 57 | (cl-rassoc-if | 54 | (cl-rassoc-if |
| @@ -61,6 +58,17 @@ | |||
| 61 | 58 | ||
| 62 | (ert-deftest nsm-check-local-subnet-ipv6 () | 59 | (ert-deftest nsm-check-local-subnet-ipv6 () |
| 63 | (skip-unless (nsm-ipv6-is-available)) | 60 | (skip-unless (nsm-ipv6-is-available)) |
| 61 | (let ((local-ip '[123 456 789 11 172 26 128 160 0]) | ||
| 62 | (mask '[255 255 255 255 255 255 255 0 0]) | ||
| 63 | |||
| 64 | (wrong-length-mask '[255 255 255 255 255 255 255]) | ||
| 65 | (wrong-mask '[255 255 255 255 255 255 255 255 0]) | ||
| 66 | (remote-ip-yes '[123 456 789 11 172 26 128 161 0]) | ||
| 67 | (remote-ip-no '[123 456 789 11 172 26 129 161 0])) | ||
| 68 | (should (eq t (nsm-network-same-subnet local-ip mask remote-ip-yes))) | ||
| 69 | (should (eq nil (nsm-network-same-subnet local-ip mask remote-ip-no))) | ||
| 70 | (should-error (nsm-network-same-subnet local-ip wrong-length-mask remote-ip-yes)) | ||
| 71 | (should (eq nil (nsm-network-same-subnet local-ip wrong-mask remote-ip-yes)))) | ||
| 64 | (should (eq t (nsm-should-check "::1"))) | 72 | (should (eq t (nsm-should-check "::1"))) |
| 65 | (let ((nsm-trust-local-network t)) | 73 | (let ((nsm-trust-local-network t)) |
| 66 | (should (eq nil (nsm-should-check "::1"))))) | 74 | (should (eq nil (nsm-should-check "::1"))))) |