diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-15 23:07:37 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-15 23:08:00 -0500 |
| commit | b54ec5aac9e25b534686c13aa2d09a61200c6fd9 (patch) | |
| tree | 519ee18efd1e8e81df1cf2d9a8b13745c74562ad /tests/test-dirvish-config-public-wrappers.el | |
| parent | 309427ee98bbcd4bc8ee1000f28e1fdd518fb415 (diff) | |
| download | dotemacs-b54ec5aac9e25b534686c13aa2d09a61200c6fd9.tar.gz dotemacs-b54ec5aac9e25b534686c13aa2d09a61200c6fd9.zip | |
fix(dirvish): mark-all-visible no longer skips every other file
dired-mark advances point itself, so the loop's extra forward-line skipped every other file (and could mark a directory). Use dired-get-filename + file-directory-p with an if/else: a marked file line advances once via dired-mark, non-file/directory lines advance manually. Replaces the regex line predicate (retired with its mock test) with a real-Dired marked-count test.
Diffstat (limited to 'tests/test-dirvish-config-public-wrappers.el')
| -rw-r--r-- | tests/test-dirvish-config-public-wrappers.el | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/tests/test-dirvish-config-public-wrappers.el b/tests/test-dirvish-config-public-wrappers.el index 0a999864..cec979e4 100644 --- a/tests/test-dirvish-config-public-wrappers.el +++ b/tests/test-dirvish-config-public-wrappers.el @@ -101,22 +101,9 @@ confused when several built-ins are overridden in the same test." (when (file-exists-p dst) (delete-file dst))))) ;;; cj/dired-mark-all-visible-files - -(ert-deftest test-dirvish-mark-all-visible-skips-directories () - "Normal: directory lines are skipped, file lines are marked." - (let ((marks 0)) - (with-temp-buffer - ;; Real dired listing has lines like " drwxr... dir/" or " -rw... file". - ;; The helper `cj/--dired-line-is-directory-p' matches "<space>d". - (insert " drwxr-xr-x subdir\n" - " -rw-r--r-- file1.txt\n" - " -rw-r--r-- file2.txt\n") - (goto-char (point-min)) - (cl-letf (((symbol-function 'dired-mark) - (lambda (&rest _) (cl-incf marks)))) - (cj/dired-mark-all-visible-files))) - ;; 2 file lines marked; the directory line + the trailing empty line skipped. - (should (= marks 2)))) +;; Covered by test-dirvish-config-mark-all-visible.el, which exercises the loop +;; against a real Dired buffer (the previous fake-buffer mock coupled to the +;; retired regex helper). ;;; cj/dired-copy-path-as-kill |
