summaryrefslogtreecommitdiff
path: root/test/lisp/files-tests.el
Commit message (Collapse)AuthorAgeFilesLines
* Merge from origin/emacs-26Paul Eggert2018-12-311-1/+1
|\ | | | | | | | | | | 2fcf2df Fix copyright years by hand 26bed8b Update copyright year to 2019 2814292 Fix value of default frame height. (Bug#33921)
| * Update copyright year to 2019Paul Eggert2019-01-011-1/+1
| | | | | | | | Run 'TZ=UTC0 admin/update-copyright $(git ls-files)'.
* | Add file name handler support for 'make-process' (Bug#28691)Philipp Stephani2018-12-221-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/process.c (Fmake_process): Add new keyword argument ':file-handler'. (syms_of_process) <make-process, :file-handler>: Define new symbols. * lisp/files.el (file-name-non-special): Add support for 'make-process'. * test/src/process-tests.el (make-process/file-handler/found) (make-process/file-handler/not-found) (make-process/file-handler/disable): New unit tests. (process-tests--file-handler): New helper function. * test/lisp/files-tests.el (files-tests-file-name-non-special-make-process): New unit test. * doc/lispref/files.texi (Magic File Names): Document that 'make-process' can invoke file name handlers. * doc/lispref/processes.texi (Asynchronous Processes): Document ':file-handlers' argument to 'make-process'. * etc/NEWS (Lisp Changes in Emacs 27.1): Mention new :file-handler argument for 'make-process'.
* | Fix selinux test in files-tests.elMichael Albinus2018-06-051-1/+2
| | | | | | | | | | | | * test/lisp/files-tests.el (files-tests-file-name-non-special-set-file-selinux-context): Adapt test.
* | Extend file-name-non-specialMichael Albinus2018-06-031-68/+421
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/files.el (insert-file-contents-literally): Bind `inhibit-file-name-handlers' the default way. (file-name-non-special): Rework, mainly for operations with two file name arguments. (file-name-unquote-non-special): New defsubst. (file-name-unquote): Use it. * test/lisp/files-tests.el (files-test-bug-18141): Skip if needed. (files-tests--with-temp-non-special): Add docstring. Delete also `non-special-name' if the file/directory exists. (files-tests--special-file-name-extension) (files-tests--special-file-name-regexp): New defconst. (files-tests--special-file-name-handler, files-tests--new-name): New defuns. (files-tests--with-temp-non-special-and-file-name-handler): New macro. (files-tests-file-name-non-special-access-file) (files-tests-file-name-non-special-add-name-to-file) (files-tests-file-name-non-special-byte-compiler-base-file-name) (files-tests-file-name-non-special-copy-directory) (files-tests-file-name-non-special-copy-file) (files-tests-file-name-non-special-delete-directory) (files-tests-file-name-non-special-delete-file) (files-tests-file-name-non-special-diff-latest-backup-file) (files-tests-file-name-non-special-directory-file-name) (files-tests-file-name-non-special-directory-files) (files-tests-file-name-non-special-directory-files-and-attributes) (files-tests-file-name-non-special-dired-compress-handler) (files-tests-file-name-non-special-dired-uncache) (files-tests-file-name-non-special-expand-file-name) (files-tests-file-name-non-special-file-accessible-directory-p) (files-tests-file-name-non-special-file-acl) (files-tests-file-name-non-special-file-attributes) (files-tests-file-name-non-special-file-directory-p) (files-tests-file-name-non-special-file-equal-p) (files-tests-file-name-non-special-file-executable-p) (files-tests-file-name-non-special-file-exists-p) (files-tests-file-name-non-special-file-in-directory-p) (files-tests-file-name-non-special-file-local-copy) (files-tests-file-name-non-special-file-modes) (files-tests-file-name-non-special-file-name-all-completions) (files-tests-file-name-non-special-file-name-as-directory) (files-tests-file-name-non-special-file-name-case-insensitive-p) (files-tests-file-name-non-special-file-name-completion) (files-tests-file-name-non-special-file-name-directory) (files-tests-file-name-non-special-file-name-nondirectory) (files-tests-file-name-non-special-file-name-sans-versions) (files-tests-file-name-non-special-file-newer-than-file-p) (files-tests-file-name-non-special-notify-handlers) (files-tests-file-name-non-special-file-ownership-preserved-p) (files-tests-file-name-non-special-file-readable-p) (files-tests-file-name-non-special-file-regular-p) (files-tests-file-name-non-special-file-remote-p) (files-tests-file-name-non-special-file-selinux-context) (files-tests-file-name-non-special-file-symlink-p) (files-tests-file-name-non-special-file-truename) (files-tests-file-name-non-special-file-writable-p) (files-tests-file-name-non-special-find-backup-file-name) (files-tests-file-name-non-special-get-file-buffer) (files-tests-file-name-non-special-insert-directory) (files-tests-file-name-non-special-insert-file-contents) (files-tests-file-name-non-special-load) (files-tests-file-name-non-special-make-auto-save-file-name) (files-tests-file-name-non-special-make-directory) (files-tests-file-name-non-special-make-directory-internal) (files-tests-file-name-non-special-make-symbolic-link) (files-tests-file-name-non-special-rename-file) (files-tests-file-name-non-special-set-file-acl) (files-tests-file-name-non-special-set-file-modes) (files-tests-file-name-non-special-set-file-selinux-context) (files-tests-file-name-non-special-set-file-times) (files-tests-file-name-non-special-set-visited-file-modtime) (files-tests-file-name-non-special-shell-command) (files-tests-file-name-non-special-start-file-process) (files-tests-file-name-non-special-substitute-in-file-name) (files-tests-file-name-non-special-temporary-file-directory) (files-tests-file-name-non-special-unhandled-file-name-directory) (files-tests-file-name-non-special-vc-registered) (files-tests-file-name-non-special-write-region): Extends tests to quoted file names, which would require a file name handler if unquoted. (files-test-no-file-write-contents): Make test more robust. * test/lisp/net/tramp-tests.el (tramp-test21-file-links): Adapt test. (tramp--test-emacs25-p): New defun. (tramp-test34-vc-registered): Use it.
* | Test notify handlers only if file notificationPaul Eggert2018-03-281-0/+1
| | | | | | | | | | | | * test/lisp/files-tests.el: (files-file-name-non-special-notify-handlers): Skip if file notification is not available.
* | Don't require all file-attributes to be equal (Bug#30327)Noam Postavsky2018-02-031-3/+17
| | | | | | | | | | | | | | | | * test/lisp/files-tests.el (files-tests-file-attributes-equal): New function. (files-tests-file-name-non-special-directory-files-and-attributes) (files-tests-file-name-non-special-file-attributes): Use it instead of `equal'.
* | * test/lisp/files-tests.el (files-tests--with-temp-non-special):Michael Albinus2018-02-031-1/+2
| | | | | | | | | | Expand `temporary-file-directory' by `file-truename', in case it is located on a symlinked directory. (Bug#30327)
* | ; Merge from emacs-26Noam Postavsky2018-02-021-12/+10
|\| | | | | | | | | 4c8157cfe0 ; Let files-tests.el pass multiple times in a session 99251ab62e ; Avoid process kill query during term tests
| * ; Let files-tests.el pass multiple times in a sessionNoam Postavsky2018-02-021-12/+10
| | | | | | | | | | | | * test/lisp/files-tests.el (files-test-local-variables): Use `cl-letf' instead of advice. The advice was not being activated on the second run.
* | Handle quoted remote file names for file notificationsMichael Albinus2018-02-021-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | * lisp/filenotify.el (file-notify-add-watch): Do not suppress other file name handlers when FILE is quoted. * test/lisp/filenotify-tests.el (file-notify-test-remote-temporary-file-directory): Beware quoted `temporary-file-directory'. * test/lisp/files-tests.el (files-tests-file-name-non-special-quote-unquote): Improve test.
* | Handle quoted file names in filenotify.elMichael Albinus2018-02-011-1/+0
| | | | | | | | | | | | | | | | | | * lisp/filenotify.el (file-notify-add-watch): Do not save quoted file names in `file-notify-descriptors'. * test/lisp/files-tests.el (files-file-name-non-special-notify-handlers): Do not expect to fail.
* | Use file-name-quote{,d-p} in files-tests.elMichael Albinus2018-02-011-15/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test/lisp/files-tests.el (files-tests-file-name-non-special-quote-unquote): New test. (files-tests--file-name-non-special--subprocess): Simplify. (files-tests--file-name-non-special--buffers) (files-tests--with-temp-non-special) (files-tests-file-name-non-special-directory-file-name) (files-tests-file-name-non-special-file-in-directory-p) (files-tests-file-name-non-special-file-name-all-completions) (files-tests-file-name-non-special-file-name-as-directory) (files-tests-file-name-non-special-file-name-completion) (files-tests-file-name-non-special-file-name-directory) (files-tests-file-name-non-special-find-backup-file-name) (files-tests-file-name-non-special-make-nearby-temp-file): Use `file-name-quote' and `file-name-quoted-p', respectively.
* | Test and fix "/:" quoted file name handlers (Bug#30243)Noam Postavsky2018-02-011-1/+400
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some w32 specific problems were discovered, but only worked around, as these are not serious, and not the focus of this bug fix: - The w32 implementation of `insert-directory doesn't handle a nil SWITCHES argument. - `dired-compress-file' does not operate correctly if the unquoted filename contains a ":" (e.g., C:/foo/bar). * lisp/files.el (file-name-non-special): Strip the "/:" from `default-directory' for `temporary-file-directory' operation; both arguments to `file-name-completion', `file-name-all-completion', and `file-equal-p' operations; `buffer-file-name' for `make-auto-save-file-name' and 'set-visited-file-modtime' operations. Don't touch any operands of `file-notify-rm-watch' and `file-notify-valid-p' as they receive descriptors; not file names (this is not sufficient to fix these operations for "/:" quoted file names though, these are fixed in a later commit). * test/lisp/files-tests.el (files-tests--with-temp-file): Give it a `debug' property. (files-tests--with-temp-non-special): New helper macro. (files-tests--file-name-non-special--subprocess): Simplify. (files-tests-file-name-non-special-quote-unquote) (files-file-name-non-special-notify-handlers) (files-file-name-non-special-handlers) (files-tests-file-name-non-special-access-file) (files-tests-file-name-non-special-add-name-to-file) (files-tests-file-name-non-special-byte-compiler-base-file-name) (files-tests-file-name-non-special-copy-directory) (files-tests-file-name-non-special-copy-file) (files-tests-file-name-non-special-delete-directory) (files-tests-file-name-non-special-delete-file) (files-tests-file-name-non-special-diff-latest-backup-file) (files-tests-file-name-non-special-directory-file-name) (files-tests-file-name-non-special-directory-files) (files-tests-file-name-non-special-directory-files-and-attributes) (files-tests-file-name-non-special-dired-uncache) (files-tests-file-name-non-special-dired-compress-handler) (files-tests-file-name-non-special-expand-file-name) (files-tests-file-name-non-special-file-accessible-directory-p) (files-tests-file-name-non-special-file-acl) (files-tests-file-name-non-special-file-attributes) (files-tests-file-name-non-special-file-directory-p) (files-tests-file-name-non-special-file-equal-p) (files-tests-file-name-non-special-file-executable-p) (files-tests-file-name-non-special-file-exists-p) (files-tests-file-name-non-special-file-in-directory-p) (files-tests-file-name-non-special-file-local-copy) (files-tests-file-name-non-special-file-modes) (files-tests-file-name-non-special-file-name-all-completions) (files-tests-file-name-non-special-file-name-as-directory) (files-tests-file-name-non-special-file-name-case-insensitive-p) (files-tests-file-name-non-special-file-name-completion) (files-tests-file-name-non-special-file-name-directory) (files-tests-file-name-non-special-file-name-nondirectory) (files-tests-file-name-non-special-file-name-sans-versions) (files-tests-file-name-non-special-file-newer-than-file-p) (files-tests-file-name-non-special-file-ownership-preserved-p) (files-tests-file-name-non-special-file-readable-p) (files-tests-file-name-non-special-file-regular-p) (files-tests-file-name-non-special-file-remote-p) (files-tests-file-name-non-special-file-selinux-context) (files-tests-file-name-non-special-file-symlink-p) (files-tests-file-name-non-special-file-truename) (files-tests-file-name-non-special-file-writable-p) (files-tests-file-name-non-special-find-backup-file-name) (files-tests-file-name-non-special-get-file-buffer) (files-tests-file-name-non-special-insert-directory) (files-tests-file-name-non-special-insert-file-contents) (files-tests-file-name-non-special-load) (files-tests-file-name-non-special-make-auto-save-file-name) (files-tests-file-name-non-special-make-directory) (files-tests-file-name-non-special-make-directory-internal) (files-tests-file-name-non-special-make-nearby-temp-file) (files-tests-file-name-non-special-make-symbolic-link) (files-tests-file-name-non-special-rename-file) (files-tests-file-name-non-special-set-file-acl) (files-tests-file-name-non-special-set-file-modes) (files-tests-file-name-non-special-set-file-selinux-context) (files-tests-file-name-non-special-set-file-times) (files-tests-file-name-non-special-set-visited-file-modtime) (files-tests-file-name-non-special-shell-command) (files-tests-file-name-non-special-start-file-process) (files-tests-file-name-non-special-substitute-in-file-name) (files-tests-file-name-non-special-temporary-file-directory) (files-tests-file-name-non-special-unhandled-file-name-directory) (files-tests-file-name-non-special-vc-registered) (files-tests-file-name-non-special-write-region): New tests.
* Update copyright year to 2018Paul Eggert2018-01-011-1/+1
| | | | Run admin/update-copyright.
* Avoid bogus abbreviated file names if HOME changesGlenn Morris2017-11-211-0/+14
| | | | | | * lisp/files.el (abbreviate-file-name): If HOME changes, ignore `abbreviated-home-dir'. (Bug#19657#20) * test/lisp/files-tests.el (files-test-abbreviated-home-dir): New.
* Fix new copy-directory bug with empty dirsPaul Eggert2017-09-201-1/+6
| | | | | | | | | Problem reported by Afdam Plaice (Bug#28520) and by Eli Zaretskii (Bug#28483#34). This is another bug that I introduced in my recent copy-directory changes. * lisp/files.el (copy-directory): Work with empty subdirectories, too. * test/lisp/files-tests.el (files-tests--copy-directory): Test for this bug.
* Cleanup in files-tests.elMichael Albinus2017-09-181-2/+4
| | | | | * test/lisp/files-tests.el (files-tests--make-directory) (files-tests--copy-directory): Cleanup temporary directories.
* Fix recently-introduced copy-directory bugPaul Eggert2017-09-171-0/+11
| | | | | | | | | | | Problem reported by Andrew Christianson (Bug#28451): * lisp/files.el (copy-directory): If COPY-CONTENTS, make the destination directory if it does not exist, even if it is a directory name. Simplify, and omit unnecessary test for an already-existing non-directory target, since make-directory diagnoses that for us now. * test/lisp/files-tests.el (files-tests--copy-directory): Test for this bug.
* Prefer HTTPS to FTP and HTTP in documentationPaul Eggert2017-09-131-3/+3
| | | | | | | | | | | | | Most of this change is to boilerplate commentary such as license URLs. This change was prompted by ftp://ftp.gnu.org's going-away party, planned for November. Change these FTP URLs to https://ftp.gnu.org instead. Make similar changes for URLs to other organizations moving away from FTP. Also, change HTTP to HTTPS for URLs to gnu.org and fsf.org when this works, as this will further help defend against man-in-the-middle attacks (for this part I omitted the MS-DOS and MS-Windows sources and the test tarballs to keep the workload down). HTTPS is not fully working to lists.gnu.org so I left those URLs alone for now.
* Allow write-contents-functions to short-circuit buffer saveEric Abrahamsen2017-09-121-0/+27
| | | | | | | | | | | | | | | | Bug#28412 * lisp/files.el (basic-save-buffer): Re-arrange function so that write-contents-functions are run earlier. If they return non-nil, consider the buffer saved without requiring the buffer to be visiting a file. (save-some-buffers): This function should consider any buffer with a buffer-local value for write-contents-functions eligible for saving. * test/lisp/files-tests.el (files-test-no-file-write-contents): New test. * doc/lispref/files.texi (Saving Buffers): Mention in docs. * etc/NEWS: And in NEWS.
* Fix some make-directory bugsPaul Eggert2017-09-101-0/+21
| | | | | | | | * lisp/files.el (files--ensure-directory): New function. (make-directory): Use it to avoid bugs when (make-directory FOO t) is invoked on a non-directory, or on a directory hierarchy that is being built by some other process while Emacs is running. * test/lisp/files-tests.el (files-tests--make-directory): New test.
* files-tests.el: Remove unused lexical variableTino Calancha2017-08-161-2/+1
| | | | | * test/lisp/files-tests.el (file-test--do-local-variables-test); Remove unused var 'files-test-queried'.
* Fix make-temp-file bug with ""/"."/".." prefixPaul Eggert2017-08-121-0/+14
| | | | | | | | | | | | | | | | | The bug with "." and ".." has been present for a while; I introduced the bug with "" earlier today in my patch for Bug#28023. * lisp/files.el (make-temp-file): Do not use expand-file-name if PREFIX is empty or "." or "..", as it does the wrong thing. Compute absolute-prefix here ... (files--make-magic-temp-file): ... instead of here ... * src/fileio.c (Fmake_temp_file_internal): ... or here. * lisp/files.el (make-temp-file): If the prefix is empty, append "/" to the absolute prefix so that the new files are children rather than siblings of temporary-file-directory. This fixes a bug introduced in the previous change. * test/lisp/files-tests.el (files-test-make-temp-file-empty-prefix): New test, for the bug.
* Fix files-tests.el for MS-WindowsEli Zaretskii2017-08-051-4/+5
| | | | | | * test/lisp/files-tests.el (files-tests--file-name-non-special--subprocess): Fix this test for MS-Windows.
* insert-directory-wildcard-in-dir-p: Tweak regexpTino Calancha2017-08-051-0/+18
| | | | | | | This function must return non-nil for a wildcard like '/*/*.txt'. * lisp/files.el (insert-directory-wildcard-in-dir-p): Adjust regexp. * test/lisp/files-tests.el (files-tests--insert-directory-wildcard-in-dir-p): Add test.
* Fix quoted files for 'verify-visited-file-modtime'Philipp Stephani2017-05-061-1/+63
| | | | | | | | | | | | Fixes Bug#25951. * lisp/files.el (file-name-non-special): Set the file name for the correct buffer. * test/lisp/files-tests.el (files-tests--file-name-non-special--buffers): Add unit test. (files-tests--with-advice, files-tests--with-temp-file): New helper macros.
* Make subprocess functions resolve the default directoryPhilipp Stephani2017-04-041-0/+8
| | | | | | | | | | | | | `call-process' doesn't respect file name handlers in `default-directory', so `file-name-non-special' has to resolve them for `process-file', `start-file-process', and `shell-command' (Bug#25949). * lisp/files.el (file-name-non-special): Also resolve default directory for 'process-file', 'start-file-process', and 'shell-command'. * test/lisp/files-tests.el (files-tests--file-name-non-special--subprocess): Add unit test.
* Merge from origin/emacs-25Paul Eggert2017-01-011-1/+1
| | | | | 2e2a806 Fix copyright years by hand 5badc81 Update copyright year to 2017
* files-test-read-file-in-: Delete temporary dir on exitTino Calancha2016-12-201-1/+1
| | | | | * test/lisp/files-tests.el (files-test-read-file-in-~): Create subdir inside dir.
* Quote filenames containing '~' in promptsNoam Postavsky2016-12-111-0/+23
| | | | | | | | | | | | When in a directory named '~', the default value given by `read-file-name' should be quoted by prepending '/:', in order to prevent it from being interpreted as referring to the $HOME directory (Bug#16984). * lisp/minibuffer.el (minibuffer-maybe-quote-filename): New function. (completion--sifn-requote, read-file-name-default): Use it instead of `minibuffer--double-dollars'. * test/lisp/files-tests.el (files-test-read-file-in-~): Test it.
* Make querying to kill processes customizablePhilipp Stephani2016-10-011-0/+23
| | | | | | | | | | | | | | | | | | | | Introduce a new customization option, `confirm-kill-processes', that users can set to nil if they don't want Emacs to nag them about killing processes. * lisp/files.el (confirm-kill-processes): New customization option. (save-buffers-kill-emacs): Use customization option. * test/lisp/files-tests.el (files-test--save-buffers-kill-emacs--confirm-kill-processes): Add test for new customization option. * doc/emacs/entering.texi (Exiting): Document new user option. * doc/lispref/processes.texi (Query Before Exit): Document new user option. * etc/NEWS: Document new user option.
* ; * test/lisp/files-tests.el: Minor copyedits.Eli Zaretskii2016-09-241-2/+3
|
* ; * test/lisp/files-tests.el: Moved from test/lisp/legacy/.Eli Zaretskii2016-09-241-0/+200