1;;; shadow-tests.el --- Test suite for shadow.  -*- lexical-binding: t -*-
2
3;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
7;; GNU Emacs is free software: you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation, either version 3 of the License, or
10;; (at your option) any later version.
11
12;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15;; GNU General Public License for more details.
16
17;; You should have received a copy of the GNU General Public License
18;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
19
20;;; Code:
21
22(require 'ert)
23(require 'ert-x)
24(require 'shadow)
25(eval-when-compile (require 'cl-lib))
26
27(ert-deftest shadow-case-insensitive ()
28  "Test shadowing for case insensitive filenames."
29  ;; Override `file-name-case-insensitive-p' so we test the same thing
30  ;; regardless of what file system we're running on.
31  (cl-letf (((symbol-function 'file-name-case-insensitive-p) (lambda (_f) t)))
32    (should (equal (list (ert-resource-file "p1/foo")
33                         (ert-resource-file "p2/FOO"))
34                   (load-path-shadows-find
35                    (list (ert-resource-file "p1/")
36                          (ert-resource-file "p2/"))))))
37  (cl-letf (((symbol-function 'file-name-case-insensitive-p) (lambda (_f) nil)))
38    (should-not (load-path-shadows-find
39                 (list (ert-resource-file "p1/")
40                       (ert-resource-file "p2/"))))))
41
42;;; shadow-tests.el ends here.
43