summaryrefslogtreecommitdiff
path: root/test/lisp/use-package/use-package-tests.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2017-12-01 10:23:06 -0800
committerJohn Wiegley <johnw@newartisans.com>2017-12-01 10:23:21 -0800
commitf5b034154f8fa2bab0375e34143de9d462ee1232 (patch)
treea4deafdeb6cb8db837651f16e91633f682eba2a0 /test/lisp/use-package/use-package-tests.el
parent21b9b6551dae815a5ccee491735d7b9a0d27d2ad (diff)
downloademacs-f5b034154f8fa2bab0375e34143de9d462ee1232.tar.gz
emacs-f5b034154f8fa2bab0375e34143de9d462ee1232.tar.bz2
emacs-f5b034154f8fa2bab0375e34143de9d462ee1232.zip
Always wrap the expanded body from use-package in (progn)
Diffstat (limited to 'test/lisp/use-package/use-package-tests.el')
-rw-r--r--test/lisp/use-package/use-package-tests.el83
1 files changed, 45 insertions, 38 deletions
diff --git a/test/lisp/use-package/use-package-tests.el b/test/lisp/use-package/use-package-tests.el
index 6710d48faa8..66a4af30b52 100644
--- a/test/lisp/use-package/use-package-tests.el
+++ b/test/lisp/use-package/use-package-tests.el
@@ -267,59 +267,59 @@
(ert-deftest use-package-test/:if ()
(match-expansion
(use-package foo :if t)
- `(if (symbol-value 't)
- (progn
- (require 'foo nil 'nil))))
+ `(progn
+ (when (symbol-value 't)
+ (require 'foo nil 'nil))))
(match-expansion
(use-package foo :if (and t t))
- `(if (and t t)
- (progn
- (require 'foo nil 'nil))))
+ `(progn
+ (when (and t t)
+ (require 'foo nil 'nil))))
(match-expansion
(use-package foo :if nil)
- `(if nil
- (progn
- (require 'foo nil 'nil)))))
+ `(progn
+ (when nil
+ (require 'foo nil 'nil)))))
(ert-deftest use-package-test/:when ()
(match-expansion
(use-package foo :when t)
- `(if (symbol-value 't)
- (progn
- (require 'foo nil 'nil))))
+ `(progn
+ (when (symbol-value 't)
+ (require 'foo nil 'nil))))
(match-expansion
(use-package foo :when (and t t))
- `(if (and t t)
- (progn
- (require 'foo nil 'nil))))
+ `(progn
+ (when (and t t)
+ (require 'foo nil 'nil))))
(match-expansion
(use-package foo :when nil)
- `(if nil
- (progn
- (require 'foo nil 'nil)))))
+ `(progn
+ (when nil
+ (require 'foo nil 'nil)))))
-(ert-deftest use-package-test/:when ()
+(ert-deftest use-package-test/:unless ()
(match-expansion
(use-package foo :unless t)
- `(if (symbol-value 't)
- nil
- (require 'foo nil 'nil)))
+ `(progn
+ (unless (symbol-value 't)
+ (require 'foo nil 'nil))))
(match-expansion
(use-package foo :unless (and t t))
- `(if (and t t)
- nil
- (require 'foo nil 'nil)))
+ `(progn
+ (unless (and t t)
+ (require 'foo nil 'nil))))
(match-expansion
(use-package foo :unless nil)
- `(if nil
- nil
- (require 'foo nil 'nil))))
+ `(progn
+ (unless nil
+ (require 'foo nil 'nil)))))
;; (ert-deftest use-package-test/:requires ()
;; (should (equal (macroexpand (use-package))
@@ -446,7 +446,8 @@
(ert-deftest use-package-test/:defines ()
(match-expansion
(use-package foo :defines bar)
- `(require 'foo nil 'nil))
+ `(progn
+ (require 'foo nil 'nil)))
(let ((byte-compile-current-file t))
(match-expansion
@@ -463,7 +464,8 @@
(ert-deftest use-package-test/:functions ()
(match-expansion
(use-package foo :functions bar)
- `(require 'foo nil 'nil))
+ `(progn
+ (require 'foo nil 'nil)))
(let ((byte-compile-current-file t))
(match-expansion
@@ -479,13 +481,17 @@
(match-expansion
(use-package foo :defer t :functions bar)
- `nil)
+ `(progn))
- ;; jww (2017-12-01): This exposes a bug.
- ;; (let ((byte-compile-current-file t))
- ;; (match-expansion
- ;; (use-package foo :defer t :functions bar)
- ;; `'nil))
+ (let ((byte-compile-current-file t))
+ (match-expansion
+ (use-package foo :defer t :functions bar)
+ `(progn
+ (eval-and-compile
+ (declare-function bar "foo")
+ (eval-when-compile
+ (with-demoted-errors "Cannot load foo: %S" nil
+ (load "foo" nil t)))))))
(let ((byte-compile-current-file t))
(match-expansion
@@ -576,8 +582,9 @@
(ert-deftest use-package-test/:after ()
(match-expansion
(use-package foo :after bar)
- `(eval-after-load 'bar
- '(require 'foo nil t))))
+ `(progn
+ (eval-after-load 'bar
+ '(require 'foo nil t)))))
;; (ert-deftest use-package-test/:demand ()
;; (should (equal (macroexpand (use-package))