Skip to content

Commit

Permalink
tests: Refactor test that no backtraces are collected for skipped specs
Browse files Browse the repository at this point in the history
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 balong together.
  • Loading branch information
snogge committed Aug 23, 2024
1 parent af77119 commit f3f12da
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions tests/test-buttercup.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)))))
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit f3f12da

Please sign in to comment.