(with-temp-buffer
(insert-file-contents tmp-name2)
(should (string-equal (buffer-string) "foo")))
- (should-error (copy-file tmp-name1 tmp-name2))
+ (should-error
+ (copy-file tmp-name1 tmp-name2)
+ :type 'file-already-exists)
(copy-file tmp-name1 tmp-name2 'ok)
(make-directory tmp-name3)
+ (should-error
+ (copy-file tmp-name1 tmp-name3)
+ :type 'file-already-exists)
(copy-file tmp-name1 (file-name-as-directory tmp-name3))
(should
(file-exists-p
(with-temp-buffer
(insert-file-contents tmp-name4)
(should (string-equal (buffer-string) "foo")))
- (should-error (copy-file tmp-name1 tmp-name4))
+ (should-error
+ (copy-file tmp-name1 tmp-name4)
+ :type 'file-already-exists)
(copy-file tmp-name1 tmp-name4 'ok)
(make-directory tmp-name5)
+ (should-error
+ (copy-file tmp-name1 tmp-name5)
+ :type 'file-already-exists)
(copy-file tmp-name1 (file-name-as-directory tmp-name5))
(should
(file-exists-p
(with-temp-buffer
(insert-file-contents tmp-name1)
(should (string-equal (buffer-string) "foo")))
- (should-error (copy-file tmp-name4 tmp-name1))
+ (should-error
+ (copy-file tmp-name4 tmp-name1)
+ :type 'file-already-exists)
(copy-file tmp-name4 tmp-name1 'ok)
(make-directory tmp-name3)
+ (should-error
+ (copy-file tmp-name4 tmp-name3)
+ :type 'file-already-exists)
(copy-file tmp-name4 (file-name-as-directory tmp-name3))
(should
(file-exists-p
(insert-file-contents tmp-name2)
(should (string-equal (buffer-string) "foo")))
(write-region "foo" nil tmp-name1)
- (should-error (rename-file tmp-name1 tmp-name2))
+ (should-error
+ (rename-file tmp-name1 tmp-name2)
+ :type 'file-already-exists)
(rename-file tmp-name1 tmp-name2 'ok)
(should-not (file-exists-p tmp-name1))
(write-region "foo" nil tmp-name1)
(make-directory tmp-name3)
+ (should-error
+ (rename-file tmp-name1 tmp-name3)
+ :type 'file-already-exists)
(rename-file tmp-name1 (file-name-as-directory tmp-name3))
(should-not (file-exists-p tmp-name1))
(should
(insert-file-contents tmp-name4)
(should (string-equal (buffer-string) "foo")))
(write-region "foo" nil tmp-name1)
- (should-error (rename-file tmp-name1 tmp-name4))
+ (should-error
+ (rename-file tmp-name1 tmp-name4)
+ :type 'file-already-exists)
(rename-file tmp-name1 tmp-name4 'ok)
(should-not (file-exists-p tmp-name1))
(write-region "foo" nil tmp-name1)
(make-directory tmp-name5)
+ (should-error
+ (rename-file tmp-name1 tmp-name5)
+ :type 'file-already-exists)
(rename-file tmp-name1 (file-name-as-directory tmp-name5))
(should-not (file-exists-p tmp-name1))
(should
(insert-file-contents tmp-name1)
(should (string-equal (buffer-string) "foo")))
(write-region "foo" nil tmp-name4 nil 'nomessage)
- (should-error (rename-file tmp-name4 tmp-name1))
+ (should-error
+ (rename-file tmp-name4 tmp-name1)
+ :type 'file-already-exists)
(rename-file tmp-name4 tmp-name1 'ok)
(should-not (file-exists-p tmp-name4))
(write-region "foo" nil tmp-name4 nil 'nomessage)
(make-directory tmp-name3)
+ (should-error
+ (rename-file tmp-name4 tmp-name3)
+ :type 'file-already-exists)
(rename-file tmp-name4 (file-name-as-directory tmp-name3))
(should-not (file-exists-p tmp-name4))
(should
(make-directory tmp-name1)
(should (file-directory-p tmp-name1))
(should (file-accessible-directory-p tmp-name1))
- (should-error (make-directory tmp-name2))
+ (should-error (make-directory tmp-name2) :type 'file-error)
(make-directory tmp-name2 'parents)
(should (file-directory-p tmp-name2))
(should (file-accessible-directory-p tmp-name2)))
(should (file-directory-p tmp-name))
(write-region "foo" nil (expand-file-name "bla" tmp-name))
(should (file-exists-p (expand-file-name "bla" tmp-name)))
- (should-error (delete-directory tmp-name))
+ (should-error (delete-directory tmp-name) :type 'file-error)
(delete-directory tmp-name 'recursive)
(should-not (file-directory-p tmp-name)))))
(should (file-directory-p tmp-name2))
(should (file-exists-p tmp-name5))
;; Target directory does exist already.
+ (should-error
+ (copy-directory tmp-name1 tmp-name2)
+ :type 'file-error)
(copy-directory tmp-name1 (file-name-as-directory tmp-name2))
(should (file-directory-p tmp-name3))
(should (file-exists-p tmp-name6)))
;; Target directory does exist already.
(delete-file tmp-name5)
(should-not (file-exists-p tmp-name5))
- (copy-directory tmp-name1 (file-name-as-directory tmp-name2)
- nil 'parents 'contents)
+ (copy-directory
+ tmp-name1 (file-name-as-directory tmp-name2)
+ nil 'parents 'contents)
(should (file-directory-p tmp-name2))
(should (file-exists-p tmp-name5))
(should-not (file-directory-p tmp-name3))
(file-truename tramp-test-temporary-file-directory))
(tmp-name1 (tramp--test-make-temp-name nil quoted))
(tmp-name2 (tramp--test-make-temp-name nil quoted))
- (tmp-name3 (tramp--test-make-temp-name 'local quoted)))
+ (tmp-name3 (tramp--test-make-temp-name 'local quoted))
+ (tmp-name4 (tramp--test-make-temp-name nil quoted)))
;; Check `make-symbolic-link'.
(unwind-protect
;; target remains unchanged, even if quoted.
(make-symbolic-link tmp-name1 tmp-name3)
(should
- (string-equal tmp-name1 (file-symlink-p tmp-name3))))
+ (string-equal tmp-name1 (file-symlink-p tmp-name3)))
+ ;; Check directory as newname.
+ (make-directory tmp-name4)
+ (should-error
+ (make-symbolic-link tmp-name1 tmp-name4)
+ :type 'file-already-exists)
+ (make-symbolic-link tmp-name1 (file-name-as-directory tmp-name4))
+ (should
+ (string-equal
+ (funcall
+ (if quoted 'tramp-compat-file-name-unquote 'identity)
+ (file-remote-p tmp-name1 'localname))
+ (file-symlink-p
+ (expand-file-name
+ (file-name-nondirectory tmp-name1) tmp-name4)))))
;; Cleanup.
(ignore-errors
(delete-file tmp-name1)
(delete-file tmp-name2)
- (delete-file tmp-name3)))
+ (delete-file tmp-name3)
+ (delete-directory tmp-name4 'recursive)))
;; Check `add-name-to-file'.
(unwind-protect
;; `tmp-name3' is a local file name.
(should-error
(add-name-to-file tmp-name1 tmp-name3)
- :type 'file-error))
+ :type 'file-error)
+ ;; Check directory as newname.
+ (make-directory tmp-name4)
+ (should-error
+ (add-name-to-file tmp-name1 tmp-name4)
+ :type 'file-already-exists)
+ (add-name-to-file tmp-name1 (file-name-as-directory tmp-name4))
+ (should
+ (file-regular-p
+ (expand-file-name (file-name-nondirectory tmp-name1) tmp-name4))))
;; Cleanup.
(ignore-errors
(delete-file tmp-name1)
- (delete-file tmp-name2)))
+ (delete-file tmp-name2)
+ (delete-directory tmp-name4 'recursive)))
;; Check `file-truename'.
(unwind-protect
(write-region "(provide 'tramp-test-load)" nil tmp-name)
;; `load' in lread.c does not pass `must-suffix'. Why?
;;(should-error
- ;; (load tmp-name nil 'nomessage 'nosuffix 'must-suffix))
+ ;; (load tmp-name nil 'nomessage 'nosuffix 'must-suffix)
+ ;; :type 'file-error)
(load tmp-name nil 'nomessage 'nosuffix)
(should (featurep 'tramp-test-load)))
(should (equal (process-status proc) 'signal))
;; An interrupted process cannot be interrupted, again.
;; Does not work reliable.
- ;; (should-error (interrupt-process proc)))
+ ;; (should-error (interrupt-process proc) :type 'error))
)
;; Cleanup.