Commit 897d0e70 authored by Damien Cassou's avatar Damien Cassou Committed by Jorgen Schäfer

Remove some warnings on test-buttercup.el

parent 34e12fd7
...@@ -15,6 +15,12 @@ ...@@ -15,6 +15,12 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; Define test-suites to test buttercup itself. This test suite
;; should pass for all Emacs versions defined in the .travis.yml file
;; in the project directory root.
;;; Code: ;;; Code:
(require 'buttercup) (require 'buttercup)
...@@ -23,7 +29,7 @@ ...@@ -23,7 +29,7 @@
(require 'cl-lib) (require 'cl-lib)
(defun make-list-of-closures (items) (defun make-list-of-closures (items)
"For each element of ITEMS, return a closure that returns it." "For each element of ITEMS, return a closure returning it."
(mapcar (lambda (item) (mapcar (lambda (item)
(lambda () item)) (lambda () item))
items)) items))
...@@ -277,7 +283,7 @@ ...@@ -277,7 +283,7 @@
"su1 su2")))) "su1 su2"))))
(describe "The `buttercup-spec-full-name' function" (describe "The `buttercup-spec-full-name' function"
(let (su1 su2 sp1) (let (su1 su2 sp1 sp2)
(before-each (before-each
(setq su1 (make-buttercup-suite :description "su1") (setq su1 (make-buttercup-suite :description "su1")
su2 (make-buttercup-suite :description "su2") su2 (make-buttercup-suite :description "su2")
...@@ -372,7 +378,7 @@ ...@@ -372,7 +378,7 @@
(it "should add a spec to the current suite" (it "should add a spec to the current suite"
(let ((buttercup--current-suite (make-buttercup-suite))) (let ((buttercup--current-suite (make-buttercup-suite)))
(buttercup-it "the test spec" (buttercup-it "the test spec"
(lambda () 23)) (lambda () 23))
(let ((spec (car (buttercup-suite-children buttercup--current-suite)))) (let ((spec (car (buttercup-suite-children buttercup--current-suite))))
(expect (buttercup-spec-description spec) (expect (buttercup-spec-description spec)
:to-equal :to-equal
...@@ -461,7 +467,7 @@ ...@@ -461,7 +467,7 @@
(it "should be a no-op" (it "should be a no-op"
(expect (buttercup-xdescribe (expect (buttercup-xdescribe
"bla bla" "bla bla"
(lambda () (error "should not happen"))) (lambda () (error "Should not happen")))
:not :to-throw)) :not :to-throw))
(it "should add a pending suite" (it "should add a pending suite"
...@@ -489,13 +495,13 @@ ...@@ -489,13 +495,13 @@
(let ((buttercup--current-suite (make-buttercup-suite))) (let ((buttercup--current-suite (make-buttercup-suite)))
(buttercup-xit (buttercup-xit
"bla bla" "bla bla"
(lambda () (error "should not happen"))))) (lambda () (error "Should not happen")))))
:not :to-throw) :not :to-throw)
(it "should add a function that raises a pending signal" (it "should add a function that raises a pending signal"
(let ((buttercup--current-suite (make-buttercup-suite))) (let ((buttercup--current-suite (make-buttercup-suite)))
(buttercup-xit "bla bla" (lambda () (buttercup-xit "bla bla" (lambda ()
(error "should not happen"))) (error "Should not happen")))
(expect (funcall (expect (funcall
(buttercup-spec-function (buttercup-spec-function
(car (buttercup-suite-children buttercup--current-suite)))) (car (buttercup-suite-children buttercup--current-suite))))
...@@ -709,45 +715,45 @@ ...@@ -709,45 +715,45 @@
:to-equal :to-equal
23)) 23))
(it "works with strings" (it "works with strings"
(spy-on 'test-function :and-return-value "return value") (spy-on 'test-function :and-return-value "return value")
(expect (test-function 2 3) (expect (test-function 2 3)
:to-equal :to-equal
"return value")) "return value"))
(it "works with vectors" (it "works with vectors"
(spy-on 'test-function :and-return-value [1 2 3 4]) (spy-on 'test-function :and-return-value [1 2 3 4])
(expect (test-function 2 3) (expect (test-function 2 3)
:to-equal :to-equal
[1 2 3 4])) [1 2 3 4]))
(it "works with symbols" (it "works with symbols"
(spy-on 'test-function :and-return-value 'symbol) (spy-on 'test-function :and-return-value 'symbol)
(expect (test-function 2 3) (expect (test-function 2 3)
:to-equal :to-equal
'symbol)) 'symbol))
(it "works with conses" (it "works with conses"
(spy-on 'test-function :and-return-value '(1 . 2)) (spy-on 'test-function :and-return-value '(1 . 2))
(expect (test-function 2 3) (expect (test-function 2 3)
:to-equal :to-equal
(cons 1 2))) (cons 1 2)))
(it "works with lists" (it "works with lists"
(spy-on 'test-function :and-return-value '(1 2 3)) (spy-on 'test-function :and-return-value '(1 2 3))
(expect (test-function 2 3) (expect (test-function 2 3)
:to-equal :to-equal
'(1 2 3))) '(1 2 3)))
(it "works with alists" (it "works with alists"
(spy-on 'test-function :and-return-value '((first . 1) (spy-on 'test-function :and-return-value '((first . 1)
(second . 2) (second . 2)
(third . 3))) (third . 3)))
(expect (test-function 2 3) (expect (test-function 2 3)
:to-equal :to-equal
'((first . 1) '((first . 1)
(second . 2) (second . 2)
(third . 3))))) (third . 3)))))
(describe ":and-call-fake keyword functionality" (describe ":and-call-fake keyword functionality"
(before-each (before-each
...@@ -953,3 +959,7 @@ ...@@ -953,3 +959,7 @@
(expect specs :to-be-truthy) (expect specs :to-be-truthy)
(expect (length (cdr specs)) :to-equal 1) (expect (length (cdr specs)) :to-equal 1)
(expect (cl-caadr specs) :to-equal "should fontify special keywords"))))) (expect (cl-caadr specs) :to-equal "should fontify special keywords")))))
(provide 'test-buttercup)
;;; test-buttercup.el ends here
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment