branch: externals/tramp-hlo
commit 41a014a09268046cae8a24584a062012861840b4
Author: Joe Sadusk <[email protected]>
Commit: Joe Sadusk <[email protected]>

    Flushed out unit tests
---
 tramp-hlo-tests.el | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 63 insertions(+), 4 deletions(-)

diff --git a/tramp-hlo-tests.el b/tramp-hlo-tests.el
index e80cd833a3..49043257b2 100644
--- a/tramp-hlo-tests.el
+++ b/tramp-hlo-tests.el
@@ -149,7 +149,6 @@ The result must be equal."
 
       (tramp-hlo--run-test 'dir-locals--all-files tmpdir)))))
 
-;; TODO: Add more scenarii.
 (ert-deftest tramp-hlo-test-dir-locals-find-file ()
   "Test `dir-locals-find-file'."
   (skip-unless (tramp-hlo--test-enabled))
@@ -163,9 +162,33 @@ The result must be equal."
 
     ;; Use absolute directory.
     (tramp-hlo--run-test
-     'dir-locals-find-file (file-name-concat tmpdir "foo" "bar" "baz"))))
+     'dir-locals-find-file (file-name-concat tmpdir "foo" "bar" "baz"))
+
+    ;; Subdirectory that doesn't exist yet
+    (tramp-hlo--run-test
+     'dir-locals-find-file (file-name-concat tmpdir "foo" "bar" "baz" "blah" 
"bloo"))
+
+    ;; Use relative directory
+    (let ((default-directory (file-name-concat tmpdir "foo" "bar" "baz")))
+      (tramp-hlo--run-test 'dir-locals-find-file "./")
+      )
+
+    ;; With space in directory name
+    (make-directory (file-name-concat tmpdir "foo" "bar bar") 'parents)
+    
+    ;; Use absolute directory.
+    (tramp-hlo--run-test
+     'dir-locals-find-file (file-name-concat tmpdir "foo" "bar bar" "baz"))
+
+    ;; Subdirectory that doesn't exist yet
+    (tramp-hlo--run-test
+     'dir-locals-find-file (file-name-concat tmpdir "foo" "bar bar" "baz" 
"blah" "bloo"))
+
+    ;; Use relative directory
+    (let ((default-directory (file-name-concat tmpdir "foo" "bar bar" "baz")))
+      (tramp-hlo--run-test 'dir-locals-find-file "./")
+      (tramp-hlo--run-test 'dir-locals-find-file "./blah/bleh"))))
 
-;; TODO: Add more scenarii.
 (ert-deftest tramp-hlo-test-locate-dominating-file ()
   "Test `locate-dominating-file'."
   (skip-unless (tramp-hlo--test-enabled))
@@ -180,7 +203,43 @@ The result must be equal."
      'locate-dominating-file
      (file-name-concat tmpdir "foo" "bar" "baz") dir-locals-file)
     (tramp-hlo--run-test
-     'locate-dominating-file (file-name-concat tmpdir "foo" "bar" "baz") 
"foo")))
+     'locate-dominating-file (file-name-concat tmpdir "foo" "bar" "baz") "foo")
+
+    ;; Use subdirectory that doesn't exist yet
+    (tramp-hlo--run-test
+     'locate-dominating-file (file-name-concat tmpdir "foo" "bar" "baz" "blah" 
"bleh") dir-locals-file)
+    (tramp-hlo--run-test
+     'locate-dominating-file (file-name-concat tmpdir "foo" "bar" "baz" "blah" 
"bleh") "foo")
+    ;; Use relative directory.
+    (let ((default-directory (file-name-concat tmpdir "foo" "bar" "baz")))
+      (tramp-hlo--run-test 'locate-dominating-file "./" dir-locals-file)
+      (tramp-hlo--run-test 'locate-dominating-file "./" "foo")
+      (tramp-hlo--run-test 'locate-dominating-file "./blah/bleh" "foo")
+      (tramp-hlo--run-test 'locate-dominating-file "./blah/bleh" 
dir-locals-file)
+      )
+
+    ;; Directory name with space
+    (make-directory (file-name-concat tmpdir "foo" "bar bar") 'parents)
+    ;; Use absolute directory.  Search for regular file and directory.
+    (tramp-hlo--run-test
+     'locate-dominating-file
+     (file-name-concat tmpdir "foo" "bar bar" "baz") dir-locals-file)
+    (tramp-hlo--run-test
+     'locate-dominating-file (file-name-concat tmpdir "foo" "bar bar" "baz") 
"foo")
+
+    ;; Use subdirectory that doesn't exist yet
+    (tramp-hlo--run-test
+     'locate-dominating-file (file-name-concat tmpdir "foo" "bar bar" "baz" 
"blah" "bleh") dir-locals-file)
+    (tramp-hlo--run-test
+     'locate-dominating-file (file-name-concat tmpdir "foo" "bar bar" "baz" 
"blah" "bleh") "foo")
+    ;; Use relative directory.
+    (let ((default-directory (file-name-concat tmpdir "foo" "bar bar" "baz")))
+      (tramp-hlo--run-test 'locate-dominating-file "./" dir-locals-file)
+      (tramp-hlo--run-test 'locate-dominating-file "./" "foo")
+      (tramp-hlo--run-test 'locate-dominating-file "./blah/bleh" "foo")
+      (tramp-hlo--run-test 'locate-dominating-file "./blah/bleh" 
dir-locals-file)
+      )))
+
 
 (provide 'tramp-hlo-tests)
 

Reply via email to