summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2022-07-28 14:38:24 +0200
committerStefan Kangas <stefan@marxist.se>2022-07-28 15:07:34 +0200
commitb8fdef7aa65f5b1d2eeb726ff1627d9e169c2b3a (patch)
treef743b882b3da21c38cafe40eb05634f72f844e96 /test
parent38e7400a8c1feaba4362c3d7ab9d44d360a1fac6 (diff)
downloademacs-b8fdef7aa65f5b1d2eeb726ff1627d9e169c2b3a.tar.gz
Convert ffap comments to tests
* test/lisp/ffap-tests.el (ffap-file-remote-p, ffap-machine-p): New tests.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/ffap-tests.el19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/lisp/ffap-tests.el b/test/lisp/ffap-tests.el
index a11af9507ef..076d8256421 100644
--- a/test/lisp/ffap-tests.el
+++ b/test/lisp/ffap-tests.el
@@ -33,6 +33,25 @@
(ffap-replace-file-component "/ftp:who@foo.com:/whatever" "/new")
"/ftp:who@foo.com:/new")))
+(ert-deftest ffap-file-remote-p ()
+ (dolist (test '(("/user@foo.bar.com:/pub" .
+ "/user@foo.bar.com:/pub")
+ ("/cssun.mathcs.emory.edu://dir" .
+ "/cssun.mathcs.emory.edu:/dir")
+ ("/ffap.el:80" .
+ "/ffap.el:80")))
+ (let ((A (car test))
+ (B (cdr test)))
+ (should (equal (ffap-file-remote-p A) B)))))
+
+(ert-deftest ffap-machine-p ()
+ (should-not (ffap-machine-p "ftp"))
+ (should-not (ffap-machine-p "nonesuch"))
+ (should (eq (ffap-machine-p "ftp.mathcs.emory.edu") 'accept))
+ (should-not (ffap-machine-p "mathcs" 5678))
+ (should-not (ffap-machine-p "foo.bonk"))
+ (should (eq (ffap-machine-p "foo.bonk.com") 'accept)))
+
(ert-deftest ffap-tests-25243 ()
"Test for https://debbugs.gnu.org/25243 ."
(ert-with-temp-file file