emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r115088: * automated/file-notify-tests.el (file-noti


From: Michael Albinus
Subject: [Emacs-diffs] trunk r115088: * automated/file-notify-tests.el (file-notify-test02-events)
Date: Wed, 13 Nov 2013 15:36:19 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115088
revision-id: address@hidden
parent: address@hidden
committer: Michael Albinus <address@hidden>
branch nick: trunk
timestamp: Wed 2013-11-13 16:36:12 +0100
message:
  * automated/file-notify-tests.el (file-notify-test02-events)
  (file-notify-test03-autorevert): Suppress messages in `write-region'.
  
  * automated/tramp-tests.el (tramp-test02-file-name-dissect)
  (tramp-test03-file-name-defaults, tramp-test21-file-links): Add tests.
  (tramp-test26-process-file, tramp-test28-shell-command): Ensure,
  that the directory is not empty when calling "ls".
modified:
  test/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-8588
  test/automated/file-notify-tests.el 
filenotifytests.el-20130702144123-sxglvo6zs3jcj8w1-1
  test/automated/tramp-tests.el  tramptests.el-20131105142319-d9zp3oprkpxj5v1e-1
=== modified file 'test/ChangeLog'
--- a/test/ChangeLog    2013-11-11 15:22:57 +0000
+++ b/test/ChangeLog    2013-11-13 15:36:12 +0000
@@ -1,3 +1,13 @@
+2013-11-13  Michael Albinus  <address@hidden>
+
+       * automated/file-notify-tests.el (file-notify-test02-events)
+       (file-notify-test03-autorevert): Suppress messages in `write-region'.
+
+       * automated/tramp-tests.el (tramp-test02-file-name-dissect)
+       (tramp-test03-file-name-defaults, tramp-test21-file-links): Add tests.
+       (tramp-test26-process-file, tramp-test28-shell-command): Ensure,
+       that the directory is not empty when calling "ls".
+
 2013-11-11  Michael Albinus  <address@hidden>
 
        * automated/tramp-tests.el (tramp-test-temporary-file-directory):

=== modified file 'test/automated/file-notify-tests.el'
--- a/test/automated/file-notify-tests.el       2013-11-08 09:31:15 +0000
+++ b/test/automated/file-notify-tests.el       2013-11-13 15:36:12 +0000
@@ -189,16 +189,19 @@
                 '(change) 'file-notify--test-event-handler))
 
          ;; Check creation and removal.
-         (write-region "any text" nil file-notify--test-tmpfile)
+         (write-region
+          "any text" nil file-notify--test-tmpfile nil 'no-message)
          (delete-file file-notify--test-tmpfile)
 
          ;; Check copy and rename.
-         (write-region "any text" nil file-notify--test-tmpfile)
+         (write-region
+          "any text" nil file-notify--test-tmpfile nil 'no-message)
          (copy-file file-notify--test-tmpfile file-notify--test-tmpfile1)
          (delete-file file-notify--test-tmpfile)
          (delete-file file-notify--test-tmpfile1)
 
-         (write-region "any text" nil file-notify--test-tmpfile)
+         (write-region
+          "any text" nil file-notify--test-tmpfile nil 'no-message)
          (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1)
          (delete-file file-notify--test-tmpfile1))
 
@@ -234,7 +237,8 @@
        (progn
          (setq file-notify--test-tmpfile (file-notify--test-make-temp-name))
 
-         (write-region "any text" nil file-notify--test-tmpfile)
+         (write-region
+          "any text" nil file-notify--test-tmpfile nil 'no-message)
          (setq buf (find-file-noselect file-notify--test-tmpfile))
          (with-current-buffer buf
            (should (string-equal (buffer-string) "any text"))

=== modified file 'test/automated/tramp-tests.el'
--- a/test/automated/tramp-tests.el     2013-11-11 15:22:57 +0000
+++ b/test/automated/tramp-tests.el     2013-11-13 15:36:12 +0000
@@ -319,8 +319,26 @@
     (should (string-equal
             (file-remote-p "/method:address@hidden:" 'localname) ""))
 
-    ;; This does not work.  Why?
-    ;(should (file-remote-p "/[]:"))
+    ;; Expand `tramp-default-method', `tramp-default-user' and
+    ;; `tramp-default-host'.
+    (should (string-equal
+            (file-remote-p "/[]:")
+            (format
+             "/%s:address@hidden:" "default-method" "default-user" 
"default-host")))
+    (should (string-equal (file-remote-p "/[]:" 'method) "default-method"))
+    (should (string-equal (file-remote-p "/[]:" 'user) "default-user"))
+    (should (string-equal (file-remote-p "/[]:" 'host) "default-host"))
+    (should (string-equal (file-remote-p "/[]:" 'localname) ""))
+
+    ;; Expand `tramp-default-method' and `tramp-default-user'.
+    (let ((tramp-default-host "::1"))
+      (should (string-equal
+              (file-remote-p "/[]:")
+              (format "/%s:address@hidden:" "default-method" "default-user" 
"[::1]")))
+      (should (string-equal (file-remote-p "/[]:" 'method) "default-method"))
+      (should (string-equal (file-remote-p "/[]:" 'user) "default-user"))
+      (should (string-equal (file-remote-p "/[]:" 'host) "::1"))
+      (should (string-equal (file-remote-p "/[]:" 'localname) "")))
 
     ;; Expand `tramp-default-method' and `tramp-default-user'.
     (should (string-equal
@@ -436,19 +454,21 @@
   (dolist (u '("ftp" "anonymous"))
     (should (string-equal (file-remote-p (format "/%s@:" u) 'method) "ftp")))
   ;; Default values in tramp-gvfs.el.
-  ;(should (string-equal (file-remote-p "/synce::" 'user) nil))
+  (when (and (load "tramp-gvfs" 'noerror 'nomessage)
+            (symbol-value 'tramp-gvfs-enabled))
+    (should (string-equal (file-remote-p "/synce::" 'user) nil)))
   ;; Default values in tramp-gw.el.
   (dolist (m '("tunnel" "socks"))
-    (should (string-equal (file-remote-p (format "/%s::" m) 'user)
-                         (user-login-name))))
+    (should
+     (string-equal (file-remote-p (format "/%s::" m) 'user) 
(user-login-name))))
   ;; Default values in tramp-sh.el.
   (dolist (h `("127.0.0.1" "[::1]" "localhost" "localhost6" ,(system-name)))
     (should (string-equal (file-remote-p (format "/address@hidden:" h) 
'method) "su")))
   (dolist (m '("su" "sudo" "ksu"))
     (should (string-equal (file-remote-p (format "/%s::" m) 'user) "root")))
   (dolist (m '("rcp" "remcp" "rsh" "telnet" "krlogin" "fcp"))
-    (should (string-equal (file-remote-p (format "/%s::" m) 'user)
-                         (user-login-name))))
+    (should
+     (string-equal (file-remote-p (format "/%s::" m) 'user) 
(user-login-name))))
   ;; Default values in tramp-smb.el.
   (should (string-equal (file-remote-p "/address@hidden:" 'method) "smb"))
   (should (string-equal (file-remote-p "/smb::" 'user) nil)))
@@ -456,65 +476,75 @@
 (ert-deftest tramp-test04-substitute-in-file-name ()
   "Check `substitute-in-file-name'."
   (should (string-equal (substitute-in-file-name "/method:host://foo") "/foo"))
-  (should (string-equal
-          (substitute-in-file-name "/method:host:/path//foo")
-          "/method:host:/foo"))
-  (should (string-equal
-          (substitute-in-file-name "/method:host:/path///foo") "/foo"))
-  (should (string-equal
-          (substitute-in-file-name "/method:host:/path/~/foo")
-          "/method:host:~/foo"))
-  (should (string-equal
-          (substitute-in-file-name "/method:host:/path//~/foo") "~/foo"))
+  (should
+   (string-equal
+    (substitute-in-file-name "/method:host:/path//foo") "/method:host:/foo"))
+  (should
+   (string-equal (substitute-in-file-name "/method:host:/path///foo")  "/foo"))
+  (should
+   (string-equal
+    (substitute-in-file-name "/method:host:/path/~/foo") "/method:host:~/foo"))
+  (should
+   (string-equal (substitute-in-file-name "/method:host:/path//~/foo") 
"~/foo"))
   (let (process-environment)
     (should
-     (string-equal (substitute-in-file-name "/method:host:/path/$FOO")
-                  "/method:host:/path/$FOO"))
+     (string-equal
+      (substitute-in-file-name "/method:host:/path/$FOO")
+      "/method:host:/path/$FOO"))
     (setenv "FOO" "bla")
-    (should (string-equal
-            (substitute-in-file-name "/method:host:/path/$FOO")
-            "/method:host:/path/bla"))
-    (should (string-equal
-            (substitute-in-file-name "/method:host:/path/$$FOO")
-            "/method:host:/path/$FOO"))))
+    (should
+     (string-equal
+      (substitute-in-file-name "/method:host:/path/$FOO")
+      "/method:host:/path/bla"))
+    (should
+     (string-equal
+      (substitute-in-file-name "/method:host:/path/$$FOO")
+      "/method:host:/path/$FOO"))))
 
 (ert-deftest tramp-test05-expand-file-name ()
   "Check `expand-file-name'."
-  (should (string-equal
-          (expand-file-name "/method:host:/path/./file")
-          "/method:host:/path/file"))
-  (should (string-equal
-          (expand-file-name "/method:host:/path/../file")
-          "/method:host:/file")))
+  (should
+   (string-equal
+    (expand-file-name "/method:host:/path/./file") "/method:host:/path/file"))
+  (should
+   (string-equal
+    (expand-file-name "/method:host:/path/../file") "/method:host:/file")))
 
 (ert-deftest tramp-test06-directory-file-name ()
   "Check `directory-file-name'.
 This checks also `file-name-as-directory', `file-name-directory'
 and `file-name-nondirectory'."
-  (should (string-equal
-          (directory-file-name "/method:host:/path/to/file")
-          "/method:host:/path/to/file"))
-  (should (string-equal
-          (directory-file-name "/method:host:/path/to/file/")
-          "/method:host:/path/to/file"))
-  (should (string-equal
-          (file-name-as-directory "/method:host:/path/to/file")
-          "/method:host:/path/to/file/"))
-  (should (string-equal
-          (file-name-as-directory "/method:host:/path/to/file/")
-          "/method:host:/path/to/file/"))
-  (should (string-equal
-          (file-name-directory "/method:host:/path/to/file")
-          "/method:host:/path/to/"))
-  (should (string-equal
-          (file-name-directory "/method:host:/path/to/file/")
-          "/method:host:/path/to/file/"))
-  (should (string-equal
-          (file-name-nondirectory "/method:host:/path/to/file") "file"))
-  (should (string-equal
-          (file-name-nondirectory "/method:host:/path/to/file/") ""))
-  (should-not (file-remote-p
-              (unhandled-file-name-directory "/method:host:/path/to/file"))))
+  (should
+   (string-equal
+    (directory-file-name "/method:host:/path/to/file")
+    "/method:host:/path/to/file"))
+  (should
+   (string-equal
+    (directory-file-name "/method:host:/path/to/file/")
+    "/method:host:/path/to/file"))
+  (should
+   (string-equal
+    (file-name-as-directory "/method:host:/path/to/file")
+    "/method:host:/path/to/file/"))
+  (should
+   (string-equal
+    (file-name-as-directory "/method:host:/path/to/file/")
+    "/method:host:/path/to/file/"))
+  (should
+   (string-equal
+    (file-name-directory "/method:host:/path/to/file")
+    "/method:host:/path/to/"))
+  (should
+   (string-equal
+    (file-name-directory "/method:host:/path/to/file/")
+    "/method:host:/path/to/file/"))
+  (should
+   (string-equal (file-name-nondirectory "/method:host:/path/to/file") "file"))
+  (should
+   (string-equal (file-name-nondirectory "/method:host:/path/to/file/") ""))
+  (should-not
+   (file-remote-p
+    (unhandled-file-name-directory "/method:host:/path/to/file"))))
 
 (ert-deftest tramp-test07-file-exists-p ()
   "Check `file-exist-p', `write-region' and `delete-file'."
@@ -872,7 +902,9 @@
          (should (file-exists-p tmp-name1))
          (make-symbolic-link tmp-name1 tmp-name2)
          (should (file-symlink-p tmp-name2))
-         (should (string-equal (file-truename tmp-name2) tmp-name1)))
+         (should-not (string-equal tmp-name2 (file-truename tmp-name2)))
+         (should
+          (string-equal (file-truename tmp-name1) (file-truename tmp-name2))))
       (delete-file tmp-name1)
       (delete-file tmp-name2))))
 
@@ -955,15 +987,20 @@
 (ert-deftest tramp-test26-process-file ()
   "Check `process-file'."
   (skip-unless (tramp--test-enabled))
-  (let ((default-directory tramp-test-temporary-file-directory))
-    ;; We cannot use "/bin/true" and "/bin/false"; those paths do not
-    ;; exist on hydra.
-    (should (zerop (process-file "true")))
-    (should-not (zerop (process-file "false")))
-    (should-not (zerop (process-file "binary-does-not-exist")))
-    (with-temp-buffer
-      (should (zerop (process-file "ls" nil t)))
-      (should (> (point-max) (point-min))))))
+  (let ((tmp-name (tramp--test-make-temp-name))
+       (default-directory tramp-test-temporary-file-directory))
+    (unwind-protect
+       (progn
+         ;; We cannot use "/bin/true" and "/bin/false"; those paths
+         ;; do not exist on hydra.
+         (should (zerop (process-file "true")))
+         (should-not (zerop (process-file "false")))
+         (should-not (zerop (process-file "binary-does-not-exist")))
+         (with-temp-buffer
+           (write-region "foo" nil tmp-name)
+           (should (zerop (process-file "ls" nil t)))
+           (should (> (point-max) (point-min)))))
+      (delete-file tmp-name))))
 
 (ert-deftest tramp-test27-start-file-process ()
   "Check `start-file-process'."
@@ -1011,10 +1048,14 @@
 (ert-deftest tramp-test28-shell-command ()
   "Check `shell-command'."
   (skip-unless (tramp--test-enabled))
-  (let ((default-directory tramp-test-temporary-file-directory))
-    (with-temp-buffer
-      (shell-command "ls" (current-buffer))
-      (should (> (point-max) (point-min))))))
+  (let ((tmp-name (tramp--test-make-temp-name))
+       (default-directory tramp-test-temporary-file-directory))
+    (unwind-protect
+       (with-temp-buffer
+         (write-region "foo" nil tmp-name)
+         (shell-command "ls" (current-buffer))
+         (should (> (point-max) (point-min))))
+      (delete-file tmp-name))))
 
 ;; TODO:
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]