summaryrefslogtreecommitdiff
path: root/test/lisp/ffap-tests.el
diff options
context:
space:
mode:
Diffstat (limited to 'test/lisp/ffap-tests.el')
-rw-r--r--test/lisp/ffap-tests.el24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/lisp/ffap-tests.el b/test/lisp/ffap-tests.el
index 4b580b5af52..076d8256421 100644
--- a/test/lisp/ffap-tests.el
+++ b/test/lisp/ffap-tests.el
@@ -28,6 +28,30 @@
(require 'ert-x)
(require 'ffap)
+(ert-deftest ffap-replace-file-component ()
+ (should (equal
+ (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