11(require 'el-get )
22(require 'ert nil t )
33
4+ (el-get-register-method-alias :test :builtin )
5+
46(eval-when-compile
57 (require 'cl-lib )
68 (unless (featurep 'ert )
3537Following variables are bound to temporal values:
3638* `user-emacs-directory'
3739* `package-user-dir'
40+ * `load-path'
3841* `el-get-dir'
3942* `el-get-status-file'
4043* `el-get-status-cache'
@@ -43,6 +46,7 @@ Following variables are bound to temporal values:
4346 `(let* ((user-emacs-directory
4447 (make-temp-file " emacs.d.el-get-testing" 'dir " /" ))
4548 (package-user-dir (locate-user-emacs-file " elpa" ))
49+ (load-path load-path)
4650 (el-get-dir (mapconcat #'file-name-as-directory
4751 `(,user-emacs-directory " el-get" ) " " ))
4852 (el-get-status-file (concat el-get-dir " .status.el" ))
@@ -128,6 +132,71 @@ Following variables are bound to temporal values:
128132 el-get-test-files-dir))
129133 (el-get 'sync (mapcar 'el-get-source-name el-get-sources)))))
130134
135+ (ert-deftest el-get-update-load-path ()
136+ " Check the `load-path' is updated."
137+ (el-get-with-temp-home
138+ (let* ((recipe-a (list :name 'a :type 'test :compile nil
139+ :non-updatable 1
140+ :build '(progn (make-directory " test-load-path1" t ) nil )
141+ :load-path " test-load-path1" ))
142+ (el-get-sources (list recipe-a))
143+ (el-get-default-process-sync t ))
144+ (el-get 'sync 'a )
145+ (should (member (expand-file-name
146+ " test-load-path1" (el-get-package-directory 'a ))
147+ load-path))
148+ (plist-put recipe-a :load-path " test-load-path2" )
149+ (plist-put recipe-a :build '(progn (make-directory " test-load-path2" t ) nil ))
150+ (el-get-update 'a )
151+ (should (member (expand-file-name
152+ " test-load-path2" (el-get-package-directory 'a ))
153+ load-path))
154+ (plist-put recipe-a :load-path " test-load-path3" )
155+ (plist-put recipe-a :non-updatable 3 ) ; Needs reinstall to change.
156+ (plist-put recipe-a :build '(progn (make-directory " test-load-path3" t ) nil ))
157+ (el-get-update 'a )
158+ (should (member (expand-file-name
159+ " test-load-path3" (el-get-package-directory 'a ))
160+ load-path)))))
161+
162+ (ert-deftest el-get-update-rcp-file-load-path ()
163+ " Check the `load-path' is updated."
164+ :expected-result :failed
165+ (el-get-with-temp-home
166+ (let* ((rcpdir (expand-file-name " ~/.emacs.d/el-get-user-recipes/" ))
167+ (el-get-recipe-path (cons rcpdir el-get-recipe-path))
168+ (recipe-a (list :name 'a :type 'test :compile nil
169+ :non-updatable 1
170+ :build '(progn (make-directory " test-load-path1" t ) nil )
171+ :load-path " test-load-path1" ))
172+ (el-get-default-process-sync t ))
173+ (make-directory rcpdir t )
174+ (with-temp-file (expand-file-name " a.rcp" rcpdir)
175+ (pp recipe-a (current-buffer )))
176+ (el-get 'sync 'a )
177+ (should (member (expand-file-name
178+ " test-load-path1" (el-get-package-directory 'a ))
179+ load-path))
180+
181+ (plist-put recipe-a :load-path " test-load-path2" )
182+ (plist-put recipe-a :build '(progn (make-directory " test-load-path2" t ) nil ))
183+ (with-temp-file (expand-file-name " a.rcp" rcpdir)
184+ (pp recipe-a (current-buffer )))
185+ (el-get-update 'a )
186+ (should (member (expand-file-name
187+ " test-load-path2" (el-get-package-directory 'a ))
188+ load-path))
189+
190+ (plist-put recipe-a :load-path " test-load-path3" )
191+ (plist-put recipe-a :non-updatable 3 ) ; Needs reinstall to change.
192+ (plist-put recipe-a :build '(progn (make-directory " test-load-path3" t ) nil ))
193+ (with-temp-file (expand-file-name " a.rcp" rcpdir)
194+ (pp recipe-a (current-buffer )))
195+ (el-get-update 'a )
196+ (should (member (expand-file-name
197+ " test-load-path3" (el-get-package-directory 'a ))
198+ load-path)))))
199+
131200(ert-deftest el-get-elpa-feature ()
132201 " `:features' option should work for ELPA type recipe."
133202 :expected-result :failed
0 commit comments