branch: elpa/buttercup commit 0444816a60b33acf8d23699cb53c9feb2fdc6ebb Author: Ola Nilsson <ola.nils...@gmail.com> Commit: Ola Nilsson <ola.nils...@gmail.com>
tests: Refactor test that no backtraces are collected for skipped specs The "should not generate backtraces for skipped specs" had a lot of similarties to the two specs in the "should not be collected or printed for" suite. Move it into that suite, not only for shared code but also because they belong together. --- tests/test-buttercup.el | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/tests/test-buttercup.el b/tests/test-buttercup.el index c8b332d084..17d2da7602 100644 --- a/tests/test-buttercup.el +++ b/tests/test-buttercup.el @@ -2006,6 +2006,24 @@ before it's processed by other functions." (expect 'buttercup--backtrace :not :to-have-been-called) ;; Checking both if buttercup--backtrace have been called and ;; the failure-stack value might be overkill + (expect (cl-every #'null + (mapcar #'buttercup-spec-failure-stack + (buttercup-suite-children (car test-suites))))) + (expect (buttercup-output) :to-equal "")) + (it "skipped specs" + (with-local-buttercup + :reporter #'backtrace-reporter + (describe "one description with" + (it "one skipped spec" + (buttercup-skip "skip")) + (xit "one empty spec") + (it "one un-assumed spec" + (assume nil "A very unassuming spec"))) + (buttercup-run :noerror) + (setq test-suites buttercup-suites)) + (expect 'buttercup--backtrace :not :to-have-been-called) + ;; Checking both if buttercup--backtrace have been called and + ;; the failure-stack value might be overkill (expect (cl-every #'null (mapcar #'buttercup-spec-failure-stack (buttercup-suite-children (car test-suites))))) @@ -2159,18 +2177,7 @@ before it's processed by other functions." (matcher-spec ":to-have-been-called-with" :to-have-been-called-with 2) (matcher-spec ":not :to-have-been-called-with" :not :to-have-been-called-with 2) (matcher-spec ":to-have-been-called-times" :to-have-been-called-times 2) - (matcher-spec ":not :to-have-been-called-times" :not :to-have-been-called-times 2))) - (it "should not generate backtraces for skipped specs" - (let (test-spec) - (spy-on 'buttercup--backtrace :and-call-through) - (with-local-buttercup - (describe "one description" - (it "with a pending spec") - (buttercup-skip "skip")) - (buttercup-run :noerror) - (setq test-spec (car (buttercup-suite-children (car buttercup-suites))))) - (expect 'buttercup--backtrace :not :to-have-been-called) - (expect (buttercup-spec-failure-stack test-spec) :to-be nil)))) + (matcher-spec ":not :to-have-been-called-times" :not :to-have-been-called-times 2)))) (describe "When using quiet specs in the batch reporter"