1 ;; Copyright (C) 2015 Free Software Foundation, Inc
3 ;; Author: Rocky Bernstein <rocky@gnu.org>
5 ;; This program is free software; you can redistribute it and/or modify
6 ;; it under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation, either version 3 of the License, or
8 ;; (at your option) any later version.
10 ;; This program is distributed in the hope that it will be useful,
11 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ;; GNU General Public License for more details.
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
18 (require 'test-simple)
19 (load-file "../load-relative.el")
23 ;; (setq tempbuf (generate-new-buffer "*cmdbuf-test*"))
25 ;; (with-current-buffer tempbuf
26 ;; (insert "(__FILE__)\n")
27 ;; (eval-current-buffer))
28 ;; (kill-buffer tempbuf) "(__FILE__) on temporary buffer")
30 (assert-equal "test-load"
31 (file-name-sans-extension
32 (file-name-nondirectory (__FILE__)))
33 "(__FILE__) on this running program"
37 '("load-file1.el" "./load-file1.el" "../test/load-file1.el"))
39 (expand-file-name file-name)
40 (relative-expand-file-name file-name))
41 "relative-expand-filename"
44 (note "Basic load-relative")
45 (setq loaded-file nil)
46 (assert-equal t (load-relative "load-file2"))
47 (assert-equal "load-file3" loaded-file)
49 (setq loaded-file nil)
50 (setq loaded-file1 nil)
52 (load-relative '("load-file1" "load-file2")
54 (assert-equal 't loaded-file1)
55 (assert-equal "load-file3" loaded-file)
59 '("load-file1.el" "./load-file1.el" "../test/load-file1.el"))
60 (setq loaded-file nil)
61 (assert-equal t (load-relative file-name)
62 (format "load-relative with list file %s" loaded-file))
63 (assert-equal "load-file1" loaded-file
64 (format "load-relative value with list file %s" loaded-file)
67 (if (featurep 'require-file1 t)
68 (unload-feature 'require-file1))
70 (require-relative "require-file1")
71 (assert-t (featurep 'require-file1) "require-relative")
73 (if (featurep 'require-file1 t)
74 (unload-feature 'require-file1))
76 (require-relative-list '("require-file1" "require-file3"))
77 (assert-t (and (featurep 'require-file1)
78 (featurep 'require-file3)) "require-relative-list")
80 (if (featurep 'my-require-file2 t)
81 (unload-feature 'my-require-file2))
83 (require-relative-list '("require-file2") "my-")
84 (assert-t (featurep 'my-require-file2) "require-relative-list with prefix")
87 (if (featurep 'test-load t)
88 (unload-feature 'test-load) "provide-me - no prefix")
90 (assert-t (featurep 'test-load))
92 (if (featurep 'my-test-load t)
93 (unload-feature 'my-test-load))
95 (assert-t (featurep 'my-test-load) "provide-me - prefix")