]> git.eshelyaron.com Git - emacs.git/commitdiff
Add test for file-name-base
authorStefan Kangas <stefan@marxist.se>
Wed, 27 Oct 2021 03:34:52 +0000 (05:34 +0200)
committerStefan Kangas <stefan@marxist.se>
Wed, 27 Oct 2021 04:12:25 +0000 (06:12 +0200)
* test/lisp/files-tests.el (files-tests-file-name-base): New test.

test/lisp/files-tests.el

index b283a512a42b6d63b750b0669fcef53adec5be19..c8b80e36601abf997f775838b438988bc49a86a0 100644 (file)
@@ -1551,6 +1551,15 @@ The door of all subtleties!
   (should-error (file-name-with-extension "Jack" "."))
   (should-error (file-name-with-extension "/is/a/directory/" "css")))
 
+(ert-deftest files-tests-file-name-base ()
+  (should (equal (file-name-base) "files-tests"))
+  (should (equal (file-name-base "") ""))
+  (should (equal (file-name-base "/foo/") ""))
+  (should (equal (file-name-base "/foo") "foo"))
+  (should (equal (file-name-base "/foo/bar") "bar"))
+  (should (equal (file-name-base "foo") "foo"))
+  (should (equal (file-name-base "foo/bar") "bar")))
+
 (ert-deftest files-test-dir-locals-auto-mode-alist ()
   "Test an `auto-mode-alist' entry in `.dir-locals.el'"
   (find-file (ert-resource-file "whatever.quux"))