diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-08-19 16:48:59 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-08-19 16:48:59 -0700 |
commit | 07fcbb558d797272b9f43547da60beda485873a3 (patch) | |
tree | 77d5da14e9f9d9d8b1d877c70c01296fd3893796 /test/src/fileio-tests.el | |
parent | c9bdeff3e45a7ac84a74a81bb048046f82dddc91 (diff) | |
parent | fb81c8c3adf8633f2f617c82f6019aef630860c7 (diff) | |
download | emacs-07fcbb558d797272b9f43547da60beda485873a3.tar.gz |
Merge remote-tracking branch 'origin/master' into athena/unstable
Diffstat (limited to 'test/src/fileio-tests.el')
-rw-r--r-- | test/src/fileio-tests.el | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/test/src/fileio-tests.el b/test/src/fileio-tests.el index 7f193d4eeab..f4d123b4261 100644 --- a/test/src/fileio-tests.el +++ b/test/src/fileio-tests.el @@ -1,4 +1,4 @@ -;;; unit tests for src/fileio.c -*- lexical-binding: t; -*- +;;; fileio-tests.el --- unit tests for src/fileio.c -*- lexical-binding: t; -*- ;; Copyright 2017-2021 Free Software Foundation, Inc. @@ -160,4 +160,26 @@ Also check that an encoding error can appear in a symlink." (should-error (file-exists-p "/foo\0bar") :type 'wrong-type-argument)) +(ert-deftest fileio-tests/file-name-concat () + (should (equal (file-name-concat "foo" "bar") "foo/bar")) + (should (equal (file-name-concat "foo" "bar") "foo/bar")) + (should (equal (file-name-concat "foo" "bar" "zot") "foo/bar/zot")) + (should (equal (file-name-concat "foo/" "bar") "foo/bar")) + (should (equal (file-name-concat "foo//" "bar") "foo//bar")) + (should (equal (file-name-concat "foo/" "bar/" "zot") "foo/bar/zot")) + (should (equal (file-name-concat "fóo" "bar") "fóo/bar")) + (should (equal (file-name-concat "foo" "bár") "foo/bár")) + (should (equal (file-name-concat "fóo" "bár") "fóo/bár")) + (let ((string (make-string 5 ?a))) + (should (not (multibyte-string-p string))) + (aset string 2 255) + (should (not (multibyte-string-p string))) + (should (equal (file-name-concat "fóo" string) "fóo/aa\377aa"))) + (should (equal (file-name-concat "foo") "foo")) + (should (equal (file-name-concat "foo/") "foo/")) + (should (equal (file-name-concat "foo" "") "foo")) + (should (equal (file-name-concat "foo" "" "" "" nil) "foo")) + (should (equal (file-name-concat "" "bar") "bar")) + (should (equal (file-name-concat "" "") ""))) + ;;; fileio-tests.el ends here |