probcomp/metaprob

Break out `(is (and …))` forms into separate `(is …)` forms

開放

#105 建立於 2019年1月25日

 (0 則留言) (0 個反應) (0 位負責人)JavaScript (16 個分叉)auto 404
good first issuelow prioritytesting

倉庫指標

星標
 (170 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

Combining multiple test assertions in a single is form using and will result in uninformative error messages. For example, the following test case yields two failures when run:

(deftest example-test
  (is (= 3 (+ 1 1)))
  (is (= 5 (+ 2 2))))
Test Summary
metaprob.compositional-test

Tested 1 namespaces
Ran 2 assertions, in 1 test functions
2 failures


Results

metaprob.compositional-test
2 non-passing tests:

Fail in example-test
expected: 3

  actual: 2          
    diff: - 3          
          + 2            


Fail in example-test
expected: 5            

  actual: 4          
    diff: - 5          
          + 4

Grouping together those two assertions into a single form with and produces less informative error reporting, however:

(deftest example-test
  (is (and (= 3 (+ 1 1))
           (= 5 (+ 2 2)))))
Test Summary
metaprob.compositional-test

Tested 1 namespaces
Ran 1 assertions, in 1 test functions
1 failures


Results

metaprob.compositional-test
1 non-passing tests:

Fail in example-test
expected: (and (= 3 (+ 1 1)) (= 5 (+ 2 2)))

  actual: false          

Not only do we only get one failure, but the "actual" value is simply false.

貢獻者指南