nick8325 / quickspec

Equational laws for free
BSD 3-Clause "New" or "Revised" License
247 stars 24 forks source link

Bug: the ForQuickCheck printer produces syntactically invalid tests when run in series: #57

Open isovector opened 4 years ago

isovector commented 4 years ago

note to self:

== Laws ==                                                                                   
quickspec_laws :: [(String, Property)]                                                       
quickspec_laws =                                                                             
  [ ( "cat x failMatch = failMatch"                                                          
    , property $                                                                             
        \ (x :: Regex Bool3) ->                                                              
            cat x failMatch =~= failMatch)                                                   
  , ( "cat failMatch x = failMatch"                                                          
    , property $                                                                             
        \ (x :: Regex Bool3) ->                                                              
            cat failMatch x =~= failMatch)                                                   
  , ( "cat (cat x y) z = cat x (cat y z)"                                                    
    , property $                                                                             
        \ (x :: Regex Bool3)                                                                 
          (y :: Regex Bool3)                                                                 
          (z :: Regex Bool3) ->                                                              
            cat (cat x y) z =~= cat x (cat y z))                                             
  ]                                                                                          

== Functions ==                                                                              
(/=) :: Char -> Char -> Bool                                                                 
both :: Regex Bool3 -> Regex Bool3 -> Regex Bool3                                            

== Laws ==                                                                                   
quickspec_laws :: [(String, Property)]                                                       
quickspec_laws =                                                                             
  , ( "x /= y = y /= x"  --  <-- uh oh! there is no opening [ here
    , property $ 
isovector commented 4 years ago

I'm not entirely sure what should happen here. Perhaps the == blocks should be emitted as comments in quickspec mode, and the quickspec_laws preamble should only be generated once.