Commit d9386b0c authored by Michael Albinus's avatar Michael Albinus
Browse files

* automated/tramp-tests.el (tramp--instrument-test-case): New macro.

(tramp-test17-insert-directory): First line could contain more
text, when produced by `ls-lisp'.
(tramp-test19-directory-files-and-attributes): Instrument failed
test case.
parent ee0761ca
2014-02-20 Michael Albinus <michael.albinus@gmx.de>
* automated/tramp-tests.el (tramp--instrument-test-case): New macro.
(tramp-test17-insert-directory): First line could contain more
text, when produced by `ls-lisp'.
(tramp-test19-directory-files-and-attributes): Instrument failed
test case.
2014-02-19 Michael Albinus <michael.albinus@gmx.de> 2014-02-19 Michael Albinus <michael.albinus@gmx.de>
* automated/tramp-tests.el (tramp-test17-insert-directory): * automated/tramp-tests.el (tramp-test17-insert-directory):
......
...@@ -89,6 +89,20 @@ being the result.") ...@@ -89,6 +89,20 @@ being the result.")
(expand-file-name (expand-file-name
(make-temp-name "tramp-test") tramp-test-temporary-file-directory)) (make-temp-name "tramp-test") tramp-test-temporary-file-directory))
(defmacro tramp--instrument-test-case (verbose &rest body)
"Run BODY with `tramp-verbose' equal VERBOSE.
Print the the content of the Tramp debug buffer, if BODY does not
eval properly in `should', `should-not' or `should-error'."
`(let ((tramp-verbose ,verbose))
(condition-case err
(progn ,@body)
(ert-test-failed
(with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
(with-current-buffer (tramp-get-debug-buffer v)
(message "%s" (buffer-string))))
(signal (car err) (cdr err))))))
(put 'tramp--instrument-test-case 'lisp-indent-function 1)
(ert-deftest tramp-test00-availability () (ert-deftest tramp-test00-availability ()
"Test availability of Tramp functions." "Test availability of Tramp functions."
:expected-result (if (tramp--test-enabled) :passed :failed) :expected-result (if (tramp--test-enabled) :passed :failed)
...@@ -823,7 +837,7 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." ...@@ -823,7 +837,7 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
(goto-char (point-min)) (goto-char (point-min))
(should (should
(looking-at-p (looking-at-p
"\\(total +[[:digit:]]+\n\\)?.+ \\.\n.+ \\.\\.\n.+ foo$")))) "\\(total.+[[:digit:]]+\n\\)?.+ \\.\n.+ \\.\\.\n.+ foo$"))))
(ignore-errors (delete-directory tmp-name1 'recursive))))) (ignore-errors (delete-directory tmp-name1 'recursive)))))
(ert-deftest tramp-test18-file-attributes () (ert-deftest tramp-test18-file-attributes ()
...@@ -891,13 +905,15 @@ This tests also `file-readable-p' and `file-regular-p'." ...@@ -891,13 +905,15 @@ This tests also `file-readable-p' and `file-regular-p'."
(setq attr (directory-files-and-attributes tmp-name)) (setq attr (directory-files-and-attributes tmp-name))
(should (consp attr)) (should (consp attr))
(dolist (elt attr) (dolist (elt attr)
(should (tramp--instrument-test-case 10
(equal (file-attributes (expand-file-name (car elt) tmp-name)) (should
(cdr elt)))) (equal (file-attributes (expand-file-name (car elt) tmp-name))
(cdr elt)))))
(setq attr (directory-files-and-attributes tmp-name 'full)) (setq attr (directory-files-and-attributes tmp-name 'full))
(dolist (elt attr) (dolist (elt attr)
(should (tramp--instrument-test-case 10
(equal (file-attributes (car elt)) (cdr elt)))) (should
(equal (file-attributes (car elt)) (cdr elt)))))
(setq attr (directory-files-and-attributes tmp-name nil "^b")) (setq attr (directory-files-and-attributes tmp-name nil "^b"))
(should (equal (mapcar 'car attr) '("bar" "boz")))) (should (equal (mapcar 'car attr) '("bar" "boz"))))
(ignore-errors (delete-directory tmp-name 'recursive))))) (ignore-errors (delete-directory tmp-name 'recursive)))))
...@@ -1344,8 +1360,6 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ...@@ -1344,8 +1360,6 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
;; * set-file-acl ;; * set-file-acl
;; * set-file-selinux-context ;; * set-file-selinux-context
;; * Fix `tramp-test17-insert-directory' for
;; `ls-lisp-insert-directory' ("plink" and friends, tramp-gvfs.el).
;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?). ;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?).
;; * Fix `tramp-test28-shell-command' on MS Windows (`process-send-eof'?). ;; * Fix `tramp-test28-shell-command' on MS Windows (`process-send-eof'?).
;; * Fix `tramp-test30-utf8' on MS Windows. Seems to be in `directory-files'. ;; * Fix `tramp-test30-utf8' on MS Windows. Seems to be in `directory-files'.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment