ANNOUNCE: hspec-0.4.3 (color output and alternate mondaic api)
hspec version 0.4.3, Behavior Driven Development for Haskell, is now available! Improvements include red/yellow/green color output and writing output as the tests are running. Also, you can import Test.Hspec.Monadic rather than Test.Hspec if you want to use a WriterMonad based api. http://hackage.haskell.org/package/hspec https://github.com/trystan/hspec As always, any advice, comments, or questions are welcome, Trystan Spangler For those who would like to see an example, using the new alternate monadic api, running this program:
import Test.Hspec.Monadic import Test.Hspec.HUnit import Test.Hspec.QuickCheck (property) import Test.HUnit (assertBool, assertEqual)
main = hspec specs
specs = describe "hspec 0.4.3" $ do it "still allows a Bool expression to act as an example" (replicate 5 1 == [1,1,1,1,1])
it "still allows HUnit assertions to act as examples" (assertBool "lame example" True)
it "still allows QuickCheck properties to act as examples" (property $ \ i -> (i::Int) == i + 1 - 1)
it "still shows a list of failed examples" (undefined :: Bool) -- expected to fail
it "still collects better data from failed HUnit examples" (assertEqual "this should fail" 1 2) -- expected to fail
it "still collects better data from failed QuickCheck examples" (property $ \ i -> (i::Int) * 2 - 2 /= i) -- expected to fail
it "now allows a monadic api" (pending "I'm still not sure how to test this but this example is good evidence....")
it "now outputs in color when writing to stdout" (pending "I'm still not sure how to test this but trust me it works....")
should send this to stdout in glorious red, yellow, and green: hspec 0.4.3 - still allows a Bool expression to act as an example - still allows HUnit assertions to act as examples - still allows QuickCheck properties to act as examples x still shows a list of failed examples FAILED [1] x still collects better data from failed HUnit examples FAILED [2] x still collects better data from failed QuickCheck examples FAILED [3] - now allows a monadic api # I'm still not sure how to test this but this example is good evidence.... - now outputs in color when writing to stdout # I'm still not sure how to test this but trust me it works.... 1) hspec 0.4.3 still shows a list of failed examples FAILED Prelude.undefined 2) hspec 0.4.3 still collects better data from failed HUnit examples FAILED this should fail expected: 1 but got: 2 3) hspec 0.4.3 still collects better data from failed QuickCheck examples FAILED *** Failed! Falsifiable (after 6 tests): 2 Finished in 0.0520 seconds 8 examples, 3 failures
hspec version 0.5.0, Behavior Driven Development for Haskell, is now available! Aside from some reorganizing and a few changes to the cabal info, two functions were added since the last release: -- Use in place of hspec to also exit the program with an ExitCode hspecX :: IO Specs -> IO a -- Use in place of hspec to also give a Bool success indication hspecB :: IO Specs -> IO Bool http://hackage.haskell.org/package/hspec https://github.com/trystan/hspec Trystan Spangler
hspec version 0.6.1, Behavior Driven Development for Haskell, is now available! This latest release includes some new and requested output formats. From the hspec specs: the "hHspecWithFormat" function - can use the "silent" formatter to show no output - can use the "progress" formatter to show '..F...FF.F' style output - can use the "specdoc" formatter to show all examples (default) - can use the "failed_examples" formatter to show only failed examples http://hackage.haskell.org/package/hspec https://github.com/trystan/hspec Trystan Spangler
participants (1)
-
Trystan Spangler