Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

No output on Failed predicate #69

Open
Nimor111 opened this issue Mar 1, 2020 · 3 comments
Open

No output on Failed predicate #69

Nimor111 opened this issue Mar 1, 2020 · 3 comments

Comments

@Nimor111
Copy link

Nimor111 commented Mar 1, 2020

Hello,

This is a great package and i'd like to use it, but I have an issue that's making it basically impossible to use :/

I've setup this test:

propertySpec :: IO Connection -> Spec
propertySpec conn = describe "follows best practices" $ do
    it "doesn't return 500" $ do
        withServantServer api sserver $ \url ->
            serverSatisfies api url stdArgs (not500 <%> mempty)
    where
        sserver = do
            c <- conn
            pure $ server c

And i'm calling it from hspec like this:

  hspec $ propertySpec $ do
    pure conn

And the output i'm receiving on a failed response is:

Failures:

  src/Servant/QuickCheck/Internal/QuickCheck.hs:146:11:
  1) follows best practices doesn't return 500
       Failed:
       Nothing

  To rerun use: --match "/follows best practices/doesn't return 500/"

I've looked at the code and can't really make out why and how it's printing Nothing there, but trying with another property ( for example getsHaveCacheControlHeader ) it outputs the request and response as it should ( with the Show instance for PredicateFailure ).

I'm using version 0.0.8.0 of the package, the stack build tool, on NixOS. Happens on other Linux distros as well, without nix.

@worm2fed
Copy link

worm2fed commented May 12, 2021

same problem with servant-quickcheck-0.0.10.0!

But sometimes there are Nothing and sometimes if I run test again I receive proper output.. so strange

@mgajda
Copy link

mgajda commented Jul 4, 2021

@worm2fed @Nimor111 Can you please confirm that #81 fixes the issue?

@worm2fed
Copy link

worm2fed commented Jul 5, 2021

@mgajda I've tried to compile your branch.

so I have an error

src/Servant/QuickCheck/Internal/Equality.hs:26:32: error:
    • Could not deduce (Eq (Response b)) arising from a use of ‘==’
      from the context: Eq b
        bound by the type signature for:
                   allEquality :: forall b. Eq b => ResponseEquality b
        at src/Servant/QuickCheck/Internal/Equality.hs:25:1-41
    • In the first argument of ‘ResponseEquality’, namely ‘(==)’
      In the expression: ResponseEquality (==)
      In an equation for ‘allEquality’:
          allEquality = ResponseEquality (==)
   |
26 | allEquality = ResponseEquality (==)
   |     

Your branch depends on 0.0.9.1 version (https://github.com/mgajda/servant-quickcheck/blob/ede14d6414950ea482f65a9edf2408740e5dc187/servant-quickcheck.cabal#L2)
and latest one is 0.0.10.0 (https://github.com/haskell-servant/servant-quickcheck/tree/v0.0.10.0)
I guess this is the problem

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants