mitchellwrosen / tasty-hspec

Hspec provider for tasty
Other
14 stars 10 forks source link

Remain compatible with `tasty-quickcheck-0.9` #14

Closed JanGe closed 7 years ago

JanGe commented 7 years ago

Restoring compatibility after tasty-quickcheck-0.9 introduced a breaking change in its replay seed argument. The pragmas are a bit ugly, but the only alternative I could think of was to drop backwards compatibility.

Steps to reproduce with current master:

  1. Set stack.yaml to

    resolver: nightly-2017-06-18 extra-deps:

    • tasty-quickcheck-0.9
  2. Run stack build

  3. You should see the following error:

    
    tasty-hspec-1.1.3.1: build (lib)
    Preprocessing library tasty-hspec-1.1.3.1...
    [1 of 1] Compiling Test.Tasty.Hspec ( Test/Tasty/Hspec.hs, .stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/Test/Tasty/Hspec.o )

/Users/jan/Documents/Programmierung/Haskell/tasty-hspec/Test/Tasty/Hspec.hs:91:32: error: • Couldn't match type ‘Int’ with ‘(Test.QuickCheck.Random.QCGen, Int)’ Expected type: Maybe (Test.QuickCheck.Random.QCGen, Int) Actual type: Maybe Int • In the ‘replay’ field of a record In the expression: QC.stdArgs {QC.chatty = False, QC.maxDiscardRatio = max_ratio, QC.maxSize = max_size, QC.maxSuccess = num_tests, QC.replay = replay} In an equation for ‘qc_args’: qc_args = QC.stdArgs {QC.chatty = False, QC.maxDiscardRatio = max_ratio, QC.maxSize = max_size, QC.maxSuccess = num_tests, QC.replay = replay} where QuickCheckTests num_tests = T.lookupOption opts QuickCheckReplay replay = T.lookupOption opts QuickCheckMaxSize max_size = T.lookupOption opts QuickCheckMaxRatio max_ratio = T.lookupOption opts

-- While building package tasty-hspec-1.1.3.1 using: /Users/jan/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-osx/Cabal-1.24.2.0 build lib:tasty-hspec --ghc-options " -ddump-hi -ddump-to-file" Process exited with code: ExitFailure 1

mitchellwrosen commented 7 years ago

Thanks!

Hmm... tasty seems to be rather opinionated about this replay arg now. I think breaking compatibility is the right move here, as I don't want surprising changes in behavior when interfacing with QuickCheck either directly through tasty-quickcheck, or proxying through tasty-hspec.

What do you think?

mitchellwrosen commented 7 years ago

Oh, and don't mind the travis failures. I'm fixing them up now.

phadej commented 7 years ago

I did a few revisions on Hackage, now the matrix is a bit greener: https://matrix.hackage.haskell.org/package/tasty-hspec

Cheers, Oleg, your Hackage Trustee.

mitchellwrosen commented 7 years ago

@phadej Thanks! I will soon upload a version compatible with tasty-0.9.

JanGe commented 7 years ago

Having a function in tasty-quickcheck certainly is the better approach. So I'd say just wait for 0.9.0.1, bump up the min bounds and close this PR. But up to you, if you want to remain backwards copatible. 😉

mitchellwrosen commented 7 years ago

@JanGe Roman did some quick work merging a patch and pushing 0.9.1, so I will just close this out and fix the code up. Thanks anyways for the patch. Cheers