emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master e477b5e: Add a unit test to reproduce Bug#48471.


From: Philipp Stephani
Subject: master e477b5e: Add a unit test to reproduce Bug#48471.
Date: Mon, 17 May 2021 04:44:50 -0400 (EDT)

branch: master
commit e477b5ee12136b14af0641980f39f43e66f67f36
Author: Philipp Stephani <phst@google.com>
Commit: Philipp Stephani <phst@google.com>

    Add a unit test to reproduce Bug#48471.
    
    * test/lisp/progmodes/project-tests.el (project-tests--trivial)
    (project-root, project-ignores): New test project type.
    (project-ignores): New unit test.
---
 test/lisp/progmodes/project-tests.el | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/test/lisp/progmodes/project-tests.el 
b/test/lisp/progmodes/project-tests.el
index c8c03aa..68460a9 100644
--- a/test/lisp/progmodes/project-tests.el
+++ b/test/lisp/progmodes/project-tests.el
@@ -82,4 +82,29 @@ quoted directory names (Bug#47799)."
            (ert-fail (format-message "Unexpected references: %S"
                                      otherwise))))))))
 
+(cl-defstruct project-tests--trivial root ignores)
+
+(cl-defmethod project-root ((project project-tests--trivial))
+  (project-tests--trivial-root project))
+
+(cl-defmethod project-ignores ((project project-tests--trivial) _dir)
+  (project-tests--trivial-ignores project))
+
+(ert-deftest project-ignores ()
+  "Check that `project-files' correctly ignores the files
+returned by `project-ignores' if the root directory is a
+directory name (Bug#48471)."
+  (skip-unless (executable-find find-program))
+  (project-tests--with-temporary-directory dir
+    (make-empty-file (expand-file-name "some-file" dir))
+    (make-empty-file (expand-file-name "ignored-file" dir))
+    (let* ((project (make-project-tests--trivial
+                     :root (file-name-as-directory dir)
+                     :ignores '("./ignored-file")))
+           (files (project-files project))
+           (relative-files
+            (cl-loop for file in files
+                     collect (file-relative-name file dir))))
+      (should (equal relative-files '("some-file"))))))
+
 ;;; project-tests.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]