el-get/test/issues/el-get-issue-683.el
Stephan Creutz f4ce3bc177 Fix several regression tests
Many regression tests broke after the removal of "cl", because they
assumed "cl" is implicitly loaded. Others regression tests broke for
other reasons.

The commit fixes _not_ all regression tests. This is meant to be the
first wave.
2021-11-13 22:57:24 +01:00

71 lines
2.2 KiB
EmacsLisp

;; https://github.com/dimitri/el-get/issues/683
;;
;; el-get-remove needs to be more flexible
(require 'cl-lib)
(setq el-get-sources (list '(:name a :type builtin))
el-get-default-process-sync t)
(defun assert-package-fully-removed (pkg)
(cl-assert (null (el-get-read-package-status pkg))
nil
"Package %s should have status `nil', but actually has status \"%s\"."
pkg (el-get-read-package-status pkg))
(cl-assert (not (or (file-exists-p (el-get-package-directory pkg))
(file-symlink-p (el-get-package-directory pkg))))
nil
"Package directory for %s should not exist, but it does" pkg))
;; Try to just install and remove
(el-get-install 'a)
(el-get-remove 'a)
(assert-package-fully-removed 'a)
;; Install, then set status to "required", then uninstall.
(el-get-install 'a)
(el-get-save-package-status 'a "required")
(el-get-remove 'a)
(assert-package-fully-removed 'a)
;; Install, then set status to "removed", then uninstall.
(el-get-install 'a)
(el-get-save-package-status 'a "removed")
(el-get-remove 'a)
(assert-package-fully-removed 'a)
;; Set status to "installed" but don't actually install, then remove
(el-get-save-package-status 'a "installed")
(el-get-remove 'a)
(assert-package-fully-removed 'a)
;; Install, then set status to "required", then call install again,
;; which should remove and then reinstall.
(el-get-install 'a)
(el-get-save-package-status 'a "required")
(el-get-install 'a)
(el-get-remove 'a)
(assert-package-fully-removed 'a)
;; Install, then set status to "required", then call install again,
;; which should remove and then reinstall.
(el-get-install 'a)
(el-get-save-package-status 'a "required")
(el-get-install 'a)
(el-get-remove 'a)
(assert-package-fully-removed 'a)
;; Create the package directory but don't install it. Then try to
;; install, which should remove and reinstall.
(make-directory (el-get-package-directory 'a) 'recursive)
(el-get-install 'a)
(el-get-remove 'a)
(assert-package-fully-removed 'a)
;; Install, then set the recipe to nil in the status file, then uninstall
(el-get-install 'a)
(cl-flet ((el-get-package-def (&rest ignored) nil))
(el-get-save-package-status 'a "installed"))
(el-get-remove 'a)
(assert-package-fully-removed 'a)