summaryrefslogtreecommitdiff
path: root/test/lisp/use-package/use-package-tests.el
diff options
context:
space:
mode:
Diffstat (limited to 'test/lisp/use-package/use-package-tests.el')
-rw-r--r--test/lisp/use-package/use-package-tests.el65
1 files changed, 65 insertions, 0 deletions
diff --git a/test/lisp/use-package/use-package-tests.el b/test/lisp/use-package/use-package-tests.el
index c82256958c6..d1e68c2a790 100644
--- a/test/lisp/use-package/use-package-tests.el
+++ b/test/lisp/use-package/use-package-tests.el
@@ -1951,6 +1951,71 @@
(should (eq (nth 1 binding) 'ignore))
(should (eq (nth 2 binding) nil))))
+(ert-deftest use-package-test/:vc-1 ()
+ (match-expansion
+ (use-package foo :vc (:url "bar"))
+ '(progn (use-package-vc-install '(foo (:url "bar") :last-release) nil)
+ (require 'foo nil nil))))
+
+(ert-deftest use-package-test/:vc-2 ()
+ (match-expansion
+ (use-package foo
+ :vc (baz . (:url "baz" :vc-backend "Git"
+ :main-file qux.el :rev "rev-string")))
+ '(progn (use-package-vc-install '(baz
+ (:url "baz" :vc-backend Git :main-file "qux.el")
+ "rev-string")
+ nil)
+ (require 'foo nil nil))))
+
+(ert-deftest use-package-test/:vc-3 ()
+ (match-expansion
+ (use-package foo :vc (bar . "baz"))
+ '(progn (use-package-vc-install '(bar "baz") nil)
+ (require 'foo nil nil))))
+
+(ert-deftest use-package-test/:vc-4 ()
+ (match-expansion
+ (use-package foo :vc (bar . (:url "baz" :rev :newest)))
+ '(progn (use-package-vc-install '(bar (:url "baz") nil) nil)
+ (require 'foo nil nil))))
+
+(ert-deftest use-package-test/:vc-5 ()
+ (let ((load-path? '(pred (apply-partially
+ #'string=
+ (expand-file-name "bar" user-emacs-directory)))))
+ (match-expansion
+ (use-package foo :vc other-name :load-path "bar")
+ `(progn (eval-and-compile
+ (add-to-list 'load-path ,load-path?))
+ (use-package-vc-install '(other-name) ,load-path?)
+ (require 'foo nil nil)))))
+
+(ert-deftest use-package-test-handler/:vc-6 ()
+ (let ((byte-compile-current-file "use-package-core.el")
+ tried-to-install)
+ (cl-letf (((symbol-function #'use-package-vc-install)
+ (lambda (arg &optional local-path)
+ (setq tried-to-install arg))))
+ (should (equal
+ (use-package-handler/:vc 'foo nil 'some-pkg '(:init (foo)) nil)
+ '(foo)))
+ (should (eq tried-to-install 'some-pkg)))))
+
+(ert-deftest use-package-test-normalize/:vc ()
+ (should (equal '(foo "version-string")
+ (use-package-normalize/:vc 'foo :vc '("version-string"))))
+ (should (equal '(bar "version-string")
+ (use-package-normalize/:vc 'foo :vc '((bar . "version-string")))))
+ (should (equal '(foo (:url "bar") "baz")
+ (use-package-normalize/:vc 'foo :vc '((:url "bar" :rev "baz")))))
+ (should (equal '(foo)
+ (use-package-normalize/:vc 'foo :vc '(t))))
+ (should (equal '(foo)
+ (use-package-normalize/:vc 'foo :vc nil)))
+ (should (equal '(bar)
+ (use-package-normalize/:vc 'foo :vc '(bar)))))
+
;; Local Variables:
;; no-byte-compile: t
;; no-update-autoloads: t