]> git.eshelyaron.com Git - emacs.git/commitdiff
Add two new tests
authorJohn Wiegley <johnw@newartisans.com>
Thu, 30 Nov 2017 18:38:01 +0000 (10:38 -0800)
committerJohn Wiegley <johnw@newartisans.com>
Thu, 30 Nov 2017 18:38:01 +0000 (10:38 -0800)
test/lisp/use-package/use-package-tests.el

index a0851b0dd577d9dc3b33276f4b71d0a88a847b6c..4eb91165780e4afe0b0b474e5cd53d130dae1d83 100644 (file)
 ;;   (should (equal (macroexpand (use-package))
 ;;                  '())))
 
+(ert-deftest use-package-test-normalize/:hook ()
+  (should-error (use-package-normalize/:hook 'foopkg :hook nil))
+  (should (equal (use-package-normalize/:hook 'foopkg :hook '(bar))
+                 '((bar . foopkg))))
+  (should (equal (use-package-normalize/:hook 'foopkg :hook '((bar . baz)))
+                 '((bar . baz))))
+  (should (equal (use-package-normalize/:hook 'foopkg :hook '(((bar baz) . quux)))
+                 '(((bar baz) . quux))))
+  (should (equal (use-package-normalize/:hook 'foopkg :hook '(bar baz))
+                 '(((bar baz) . foopkg))))
+  (should (equal (use-package-normalize/:hook 'foopkg :hook '((bar baz) (quux bow)))
+                 '(((bar baz) . foopkg) ((quux bow) . foopkg))))
+  (should (equal (use-package-normalize/:hook 'foopkg :hook '((bar . baz) (quux . bow)))
+                 '((bar . baz) (quux . bow))))
+  (should (equal (use-package-normalize/:hook 'foopkg :hook '(((bar1 bar2) . baz)
+                                                              ((quux1 quux2) . bow)))
+                 '(((bar1 bar2) . baz)
+                   ((quux1 quux2) . bow)))))
+
 ;; (ert-deftest use-package-test/:hook ()
 ;;   (should (equal (macroexpand (use-package))
 ;;                  '())))
 
+(ert-deftest use-package-test-normalize/:custom ()
+  (should-error (use-package-normalize/:custom 'foopkg :custom nil))
+  (should-error (use-package-normalize/:custom 'foopkg :custom '(bar)))
+  ;; (should-error (use-package-normalize/:custom 'foopkg :custom '((foo bar baz quux))))
+  (should (equal (use-package-normalize/:custom 'foopkg :custom '(foo bar))
+                 '((foo bar))))
+  ;; (should-error (use-package-normalize/:custom 'foopkg :custom '(foo bar baz)))
+  ;; (should (equal (use-package-normalize/:custom 'foopkg :custom '(foo bar "baz"))
+  ;;                '((foo bar baz))))
+  )
+
 ;; (ert-deftest use-package-test/:custom ()
 ;;   (should (equal (macroexpand (use-package))
 ;;                  '())))