summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lisp/net/tramp-archive-tests.el18
-rw-r--r--test/lisp/net/tramp-tests.el86
-rw-r--r--test/lisp/shadowfile-tests.el32
-rw-r--r--test/lisp/wdired-tests.el4
-rw-r--r--test/src/editfns-tests.el16
-rw-r--r--test/src/regex-emacs-tests.el (renamed from test/src/regex-tests.el)6
6 files changed, 109 insertions, 53 deletions
diff --git a/test/lisp/net/tramp-archive-tests.el b/test/lisp/net/tramp-archive-tests.el
index 0a8716be0d7..e7597864c6e 100644
--- a/test/lisp/net/tramp-archive-tests.el
+++ b/test/lisp/net/tramp-archive-tests.el
@@ -311,6 +311,7 @@ This checks also `file-name-as-directory', `file-name-directory',
(ert-deftest tramp-archive-test07-file-exists-p ()
"Check `file-exist-p', `write-region' and `delete-file'."
+ :tags '(:expensive-test)
(skip-unless tramp-archive-enabled)
(unwind-protect
@@ -333,6 +334,7 @@ This checks also `file-name-as-directory', `file-name-directory',
(ert-deftest tramp-archive-test08-file-local-copy ()
"Check `file-local-copy'."
+ :tags '(:expensive-test)
(skip-unless tramp-archive-enabled)
(let (tmp-name)
@@ -359,6 +361,7 @@ This checks also `file-name-as-directory', `file-name-directory',
(ert-deftest tramp-archive-test09-insert-file-contents ()
"Check `insert-file-contents'."
+ :tags '(:expensive-test)
(skip-unless tramp-archive-enabled)
(let ((tmp-name (expand-file-name "bar/bar" tramp-archive-test-archive)))
@@ -385,6 +388,7 @@ This checks also `file-name-as-directory', `file-name-directory',
(ert-deftest tramp-archive-test11-copy-file ()
"Check `copy-file'."
+ :tags '(:expensive-test)
(skip-unless tramp-archive-enabled)
;; Copy simple file.
@@ -450,6 +454,7 @@ This checks also `file-name-as-directory', `file-name-directory',
(ert-deftest tramp-archive-test15-copy-directory ()
"Check `copy-directory'."
+ :tags '(:expensive-test)
(skip-unless tramp-archive-enabled)
(let* ((tmp-name1 (expand-file-name "bar" tramp-archive-test-archive))
@@ -504,6 +509,7 @@ This checks also `file-name-as-directory', `file-name-directory',
(ert-deftest tramp-archive-test16-directory-files ()
"Check `directory-files'."
+ :tags '(:expensive-test)
(skip-unless tramp-archive-enabled)
(let ((tmp-name tramp-archive-test-archive)
@@ -527,6 +533,7 @@ This checks also `file-name-as-directory', `file-name-directory',
(ert-deftest tramp-archive-test17-insert-directory ()
"Check `insert-directory'."
+ :tags '(:expensive-test)
(skip-unless tramp-archive-enabled)
(let (;; We test for the summary line. Keyword "total" could be localized.
@@ -569,6 +576,7 @@ This checks also `file-name-as-directory', `file-name-directory',
(ert-deftest tramp-archive-test18-file-attributes ()
"Check `file-attributes'.
This tests also `file-readable-p' and `file-regular-p'."
+ :tags '(:expensive-test)
(skip-unless tramp-archive-enabled)
(let ((tmp-name1 (expand-file-name "foo.txt" tramp-archive-test-archive))
@@ -619,6 +627,7 @@ This tests also `file-readable-p' and `file-regular-p'."
(ert-deftest tramp-archive-test19-directory-files-and-attributes ()
"Check `directory-files-and-attributes'."
+ :tags '(:expensive-test)
(skip-unless tramp-archive-enabled)
(let ((tmp-name (expand-file-name "bar" tramp-archive-test-archive))
@@ -644,6 +653,7 @@ This tests also `file-readable-p' and `file-regular-p'."
(ert-deftest tramp-archive-test20-file-modes ()
"Check `file-modes'.
This tests also `file-executable-p', `file-writable-p' and `set-file-modes'."
+ :tags '(:expensive-test)
(skip-unless tramp-archive-enabled)
(let ((tmp-name1 (expand-file-name "foo.txt" tramp-archive-test-archive))
@@ -673,6 +683,7 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'."
(ert-deftest tramp-archive-test21-file-links ()
"Check `file-symlink-p' and `file-truename'"
+ :tags '(:expensive-test)
(skip-unless tramp-archive-enabled)
;; We must use `file-truename' for the file archive, because it
@@ -711,6 +722,7 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'."
(ert-deftest tramp-archive-test26-file-name-completion ()
"Check `file-name-completion' and `file-name-all-completions'."
+ :tags '(:expensive-test)
(skip-unless tramp-archive-enabled)
(let ((tmp-name tramp-archive-test-archive))
@@ -802,8 +814,9 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'."
(zerop (nth 1 fsi))
(zerop (nth 2 fsi))))))
-(ert-deftest tramp-archive-test43-auto-load ()
+(ert-deftest tramp-archive-test44-auto-load ()
"Check that `tramp-archive' autoloads properly."
+ :tags '(:expensive-test)
(skip-unless tramp-archive-enabled)
;; Autoloading tramp-archive works since Emacs 27.1.
(skip-unless (tramp-archive--test-emacs27-p))
@@ -832,8 +845,9 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'."
(mapconcat 'shell-quote-argument load-path " -L ")
(shell-quote-argument (format code file)))))))))
-(ert-deftest tramp-archive-test43-delay-load ()
+(ert-deftest tramp-archive-test44-delay-load ()
"Check that `tramp-archive' is loaded lazily, only when needed."
+ :tags '(:expensive-test)
(skip-unless tramp-archive-enabled)
;; Autoloading tramp-archive works since Emacs 27.1.
(skip-unless (tramp-archive--test-emacs27-p))
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index c0298bb7090..293a0054560 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -5056,6 +5056,8 @@ process sentinels. They shall not disturb each other."
;; This test is inspired by Bug#29163.
(ert-deftest tramp-test43-auto-load ()
"Check that Tramp autoloads properly."
+ (skip-unless (tramp--test-enabled))
+
(let ((default-directory (expand-file-name temporary-file-directory))
(code
(format
@@ -5166,42 +5168,52 @@ Since it unloads Tramp, it shall be the last test to run."
;; cannot test older Emacsen, therefore.
(skip-unless (tramp--test-emacs26-p))
- (when (featurep 'tramp)
- (unload-feature 'tramp 'force)
- ;; No Tramp feature must be left.
- (should-not (featurep 'tramp))
- (should-not (all-completions "tramp" (delq 'tramp-tests features)))
- ;; `file-name-handler-alist' must be clean.
- (should-not (all-completions "tramp" (mapcar 'cdr file-name-handler-alist)))
- ;; There shouldn't be left a bound symbol, except buffer-local
- ;; variables, and autoload functions. We do not regard our test
- ;; symbols, and the Tramp unload hooks.
- (mapatoms
- (lambda (x)
- (and (or (and (boundp x) (null (local-variable-if-set-p x)))
- (and (functionp x) (null (autoloadp (symbol-function x)))))
- (string-match "^tramp" (symbol-name x))
- (not (string-match "^tramp--?test" (symbol-name x)))
- (not (string-match "unload-hook$" (symbol-name x)))
- (ert-fail (format "`%s' still bound" x)))))
- ;; The defstruct `tramp-file-name' and all its internal functions
- ;; shall be purged.
- (should-not (cl--find-class 'tramp-file-name))
- (mapatoms
- (lambda (x)
- (and (functionp x)
- (string-match "tramp-file-name" (symbol-name x))
- (ert-fail (format "Structure function `%s' still exists" x)))))
- ;; There shouldn't be left a hook function containing a Tramp
- ;; function. We do not regard the Tramp unload hooks.
- (mapatoms
- (lambda (x)
- (and (boundp x)
- (string-match "-\\(hook\\|function\\)s?$" (symbol-name x))
- (not (string-match "unload-hook$" (symbol-name x)))
- (consp (symbol-value x))
- (ignore-errors (all-completions "tramp" (symbol-value x)))
- (ert-fail (format "Hook `%s' still contains Tramp function" x)))))))
+ ;; We have autoloaded objects from tramp.el and tramp-archive.el.
+ ;; In order to remove them, we first need to load both packages.
+ (require 'tramp)
+ (require 'tramp-archive)
+ (should (featurep 'tramp))
+ (should (featurep 'tramp-archive))
+ ;; This unloads also tramp-archive.el and tramp-theme.el if needed.
+ (unload-feature 'tramp 'force)
+ ;; No Tramp feature must be left.
+ (should-not (featurep 'tramp))
+ (should-not (featurep 'tramp-archive))
+ (should-not (featurep 'tramp-theme))
+ (should-not
+ (all-completions
+ "tramp" (delq 'tramp-tests (delq 'tramp-archive-tests features))))
+ ;; `file-name-handler-alist' must be clean.
+ (should-not (all-completions "tramp" (mapcar 'cdr file-name-handler-alist)))
+ ;; There shouldn't be left a bound symbol, except buffer-local
+ ;; variables, and autoload functions. We do not regard our test
+ ;; symbols, and the Tramp unload hooks.
+ (mapatoms
+ (lambda (x)
+ (and (or (and (boundp x) (null (local-variable-if-set-p x)))
+ (and (functionp x) (null (autoloadp (symbol-function x)))))
+ (string-match "^tramp" (symbol-name x))
+ (not (string-match "^tramp\\(-archive\\)?--?test" (symbol-name x)))
+ (not (string-match "unload-hook$" (symbol-name x)))
+ (ert-fail (format "`%s' still bound" x)))))
+ ;; The defstruct `tramp-file-name' and all its internal functions
+ ;; shall be purged.
+ (should-not (cl--find-class 'tramp-file-name))
+ (mapatoms
+ (lambda (x)
+ (and (functionp x)
+ (string-match "tramp-file-name" (symbol-name x))
+ (ert-fail (format "Structure function `%s' still exists" x)))))
+ ;; There shouldn't be left a hook function containing a Tramp
+ ;; function. We do not regard the Tramp unload hooks.
+ (mapatoms
+ (lambda (x)
+ (and (boundp x)
+ (string-match "-\\(hook\\|function\\)s?$" (symbol-name x))
+ (not (string-match "unload-hook$" (symbol-name x)))
+ (consp (symbol-value x))
+ (ignore-errors (all-completions "tramp" (symbol-value x)))
+ (ert-fail (format "Hook `%s' still contains Tramp function" x))))))
(defun tramp-test-all (&optional interactive)
"Run all tests for \\[tramp]."
@@ -5222,7 +5234,7 @@ Since it unloads Tramp, it shall be the last test to run."
;; * Fix `tramp-test05-expand-file-name-relative' in `expand-file-name'.
;; * Fix `tramp-test06-directory-file-name' for `ftp'.
;; * Investigate, why `tramp-test11-copy-file' and `tramp-test12-rename-file'
-;; do not work properly for `owncloud'.
+;; do not work properly for `nextcloud'.
;; * Fix `tramp-test29-start-file-process' on MS Windows (`process-send-eof'?).
;; * Fix `tramp-test30-interrupt-process', timeout doesn't work reliably.
;; * Fix Bug#16928 in `tramp-test42-asynchronous-requests'.
diff --git a/test/lisp/shadowfile-tests.el b/test/lisp/shadowfile-tests.el
index 085ab476ffe..f93845da61e 100644
--- a/test/lisp/shadowfile-tests.el
+++ b/test/lisp/shadowfile-tests.el
@@ -618,7 +618,7 @@ guaranteed by the originator of a cluster definition."
shadow-test-remote-temporary-file-directory))
mocked-input `(,cluster1 ,file1 ,cluster2 ,file2 ,(kbd "RET")))
(with-temp-buffer
- (setq-local buffer-file-name file1)
+ (set-visited-file-name file1)
(call-interactively 'shadow-define-literal-group))
;; `shadow-literal-groups' is a list of lists.
@@ -679,7 +679,7 @@ guaranteed by the originator of a cluster definition."
mocked-input `(,(shadow-regexp-superquote file)
,cluster1 ,cluster2 ,(kbd "RET")))
(with-temp-buffer
- (setq-local buffer-file-name nil)
+ (set-visited-file-name nil)
(call-interactively 'shadow-define-regexp-group))
;; `shadow-regexp-groups' is a list of lists.
@@ -720,6 +720,15 @@ guaranteed by the originator of a cluster definition."
(unwind-protect
(condition-case err
(progn
+ (require 'trace)
+ (dolist (elt (all-completions "shadow-" obarray 'functionp))
+ (trace-function-background (intern elt)))
+ (trace-function-background 'save-buffer)
+ (trace-function-background 'basic-save-buffer)
+ (trace-function-background 'basic-save-buffer-1)
+ (trace-function-background 'basic-save-buffer-2)
+ (dolist (elt write-file-functions)
+ (trace-function-background elt))
;; Cleanup.
(when (file-exists-p shadow-info-file)
(delete-file shadow-info-file))
@@ -750,7 +759,7 @@ guaranteed by the originator of a cluster definition."
(message "Point 3")
;; Save file from "cluster1" definition.
(with-temp-buffer
- (setq buffer-file-name file)
+ (set-visited-file-name file)
(insert "foo")
(save-buffer))
(message "%s" file)
@@ -767,11 +776,14 @@ guaranteed by the originator of a cluster definition."
(message "Point 4.1")
(message "%s" file)
(message "%s" (shadow-site-primary cluster2))
- (setq buffer-file-name (concat (shadow-site-primary cluster2) file))
+ (set-visited-file-name (concat (shadow-site-primary cluster2) file))
(message "Point 4.2")
(insert "foo")
(message "%s" buffer-file-name)
+ (message "%s" write-file-functions)
+ (setenv "BUG_32226" "1")
(save-buffer))
+ (setenv "BUG_32226")
(message "Point 4.3")
(message "%s" (shadow-site-primary cluster2))
(message "%s" (shadow-contract-file-name (concat "/cluster1:" file)))
@@ -795,7 +807,7 @@ guaranteed by the originator of a cluster definition."
(message "Point 6")
;; Save file from "cluster1" definition.
(with-temp-buffer
- (setq buffer-file-name file)
+ (set-visited-file-name file)
(insert "foo")
(save-buffer))
(should
@@ -806,7 +818,7 @@ guaranteed by the originator of a cluster definition."
(message "Point 7")
;; Save file from "cluster2" definition.
(with-temp-buffer
- (setq buffer-file-name (concat (shadow-site-primary cluster2) file))
+ (set-visited-file-name (concat (shadow-site-primary cluster2) file))
(insert "foo")
(save-buffer))
(should
@@ -817,6 +829,10 @@ guaranteed by the originator of a cluster definition."
shadow-files-to-copy)))
(error (message "Error: %s" err) (signal (car err) (cdr err))))
+ (setenv "BUG_32226")
+ (untrace-all)
+ (message "%s" (with-current-buffer trace-buffer (buffer-string)))
+
;; Cleanup.
(when (file-exists-p shadow-info-file)
(delete-file shadow-info-file))
@@ -879,11 +895,11 @@ guaranteed by the originator of a cluster definition."
;; Save files.
(with-temp-buffer
- (setq buffer-file-name file)
+ (set-visited-file-name file)
(insert "foo")
(save-buffer))
(with-temp-buffer
- (setq buffer-file-name (concat (shadow-site-primary cluster2) file))
+ (set-visited-file-name (concat (shadow-site-primary cluster2) file))
(insert "foo")
(save-buffer))
diff --git a/test/lisp/wdired-tests.el b/test/lisp/wdired-tests.el
index b4ef4ab2486..f1ec4afb6c5 100644
--- a/test/lisp/wdired-tests.el
+++ b/test/lisp/wdired-tests.el
@@ -116,13 +116,13 @@ wdired-mode."
(kill-region (point) (progn (search-forward ".")
(forward-char -1) (point)))
(insert replace)
- (should (equal (dired-get-filename) new-file))))
+ (should (equal (dired-get-filename) new-file)))
(when buf
(with-current-buffer buf
;; Prevent kill-buffer-query-functions from chiming in.
(set-buffer-modified-p nil)
(kill-buffer buf)))
- (delete-directory test-dir t))))
+ (delete-directory test-dir t)))))
(provide 'wdired-tests)
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el
index 2951270dbf7..aa896b06499 100644
--- a/test/src/editfns-tests.el
+++ b/test/src/editfns-tests.el
@@ -88,7 +88,21 @@
(format "%-10s" (concat (propertize "01" 'face 'bold)
(propertize "23" 'face 'underline)
(propertize "45" 'face 'italic)))
- #("012345 " 0 2 (face bold) 2 4 (face underline) 4 10 (face italic)))))
+ #("012345 "
+ 0 2 (face bold) 2 4 (face underline) 4 10 (face italic))))
+ ;; Bug #32404
+ (should (ert-equal-including-properties
+ (format (concat (propertize "%s" 'face 'bold)
+ ""
+ (propertize "%s" 'face 'error))
+ "foo" "bar")
+ #("foobar" 0 3 (face bold) 3 6 (face error))))
+ (should (ert-equal-including-properties
+ (format (concat "%s" (propertize "%s" 'face 'error)) "foo" "bar")
+ #("foobar" 3 6 (face error))))
+ (should (ert-equal-including-properties
+ (format (concat "%s " (propertize "%s" 'face 'error)) "foo" "bar")
+ #("foo bar" 4 7 (face error)))))
;; Tests for bug#5131.
(defun transpose-test-reverse-word (start end)
diff --git a/test/src/regex-tests.el b/test/src/regex-emacs-tests.el
index 083ed5c4c8c..7a075908a6b 100644
--- a/test/src/regex-tests.el
+++ b/test/src/regex-emacs-tests.el
@@ -1,4 +1,4 @@
-;;; regex-tests.el --- tests for regex.c functions -*- lexical-binding: t -*-
+;;; regex-emacs-tests.el --- tests for regex-emacs.c -*- lexical-binding: t -*-
;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
@@ -24,7 +24,7 @@
(defvar regex-tests--resources-dir
(concat (concat (file-name-directory (or load-file-name buffer-file-name))
"/regex-resources/"))
- "Path to regex-resources directory next to the \"regex-tests.el\" file.")
+ "Path to regex-resources directory next to the \"regex-emacs-tests.el\" file.")
(ert-deftest regex-word-cc-fallback-test ()
"Test that \"[[:cc:]]*x\" matches \"x\" (bug#24020).
@@ -683,4 +683,4 @@ This evaluates the TESTS test cases from glibc."
(should-not (string-match "\\`x\\{65535\\}" (make-string 65534 ?x)))
(should-error (string-match "\\`x\\{65536\\}" "X") :type 'invalid-regexp))
-;;; regex-tests.el ends here
+;;; regex-emacs-tests.el ends here