-
-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests: fail-fast the test suites by default #190
Comments
Finally got a complete solution with {-# OPTIONS_GHC -fno-warn-type-defaults #-}
import Data.Foldable (for_)
import Test.Hspec (describe, it, shouldBe)
import Test.Hspec.Runner (configFastFail, defaultConfig, hspecWith)
import LeapYear (isLeapYear)
main :: IO ()
main = hspecWith defaultConfig {configFastFail = True} spec
where
spec = describe "leap"
$ describe "isLeapYear" $ for_ cases test
test (label, year, expected) = it (label ++ " (" ++ show year ++ ")")
$ isLeapYear year `shouldBe` expected
cases = [ ("leap year" , 1996, False) -- Should be True!
, ("standard and odd year" , 1997, False)
, ("standard even year" , 1998, False)
, ("standard nineteenth century", 1900, False)
, ("standard eighteenth century", 1800, False)
, ("leap twenty fourth century" , 2400, True )
, ("leap y2k" , 2000, True ) ] And it fails in the first test, without running the others: 😄
Considering that |
So...anyone against to _fail-fast_ the tests by default? |
@petertseng , what do you think about it? |
I'm not opposed, and it seems like almost every track I encounter does something similar (implementation depends on track) |
Expanding on my earlier answer: It seems makes sense to do the same in this track. Now I admit that I haven't been bothered too much by this, not enough that I get motivated to make the change myself. Nevertheless it is agreed that fast fail can make everyone happy. You will notice that #196 implies that at least some others wish to comment out tests and work iteratively! So I imagine the change would be received with gratitude by students in general. |
Considering that migrating to |
Considering that the migration it's already decided and the migration is being tracked in #211, there is not reason to keep this issue open. |
Some test suites are designed so that more complex cases come later, allowing users to incrementally solve the exercise, test by test.
I can think of three ways to deal with this usage case:
Currently, all test suites use
HUnit
(trinary and octal useQuickCheck
, but they will be deprecated by exercism/problem-specifications#279) because it was the only thing installed with the Haskell Platform. If we find a beautiful solution to fail-fastHUnit
, we can use it immediately.Alternatively, considering that we will migrate all exercises to Stack projects (#182, #189) and dependencies will not be a problem anymore, we can start to look at newer packages. I did some tests with
tasty
,tast-hunit
andtasty-fail-fast
, but they demand the user run the test with:This is great, but it would be even better to have this as the default behavior. MichaelXavier/tasty-fail-fast#2
Does anyone knows a better solution?
The text was updated successfully, but these errors were encountered: