Commits

dave4420 committed d7dd1ef

Made `propertyTester` a `Maybe PropertyTester`, so that we can set the default dynamically.

  • Participants
  • Parent commits 0d4da54

Comments (0)

Files changed (1)

 data Options = Options {modeFromOptions :: Mode,
                         nfsFromOptions :: [String],
                         flagsFromOptions :: Flags,
-                        propertyTester :: PropertyTester}
+                        propertyTester :: Maybe PropertyTester}
 data Mode = NormalMode | HelpMode | VersionMode
-noOptions = Options NormalMode [] defaultFlags QuickCheck1
+noOptions = Options NormalMode [] defaultFlags Nothing
 withModeOption mode opts = opts {modeFromOptions = mode}
 withNfOption nf opts = opts {nfsFromOptions = nf : nfsFromOptions opts}
 withNfsOption nfs opts = opts {nfsFromOptions = nfs}
+withPropertyTester pt = \opts -> opts {propertyTester = Just pt}
 alterFlags :: (Flags -> Flags) -> Options -> Options
 alterFlags f opts = opts {flagsFromOptions = f (flagsFromOptions opts)}
 
 withNdsImport nds = alterFlags $ \flags -> flags {ndsImportFromFlags = nds}
 withNdsImport' []  = withNdsImport []
 withNdsImport' nds = appEndo . mconcat . map (Endo . withNdImport) $ nds
-withPropertyTester pt = \opts -> opts {propertyTester = pt}
 
 main = fmap (foldr ($) noOptions) (getCommandLineOptions withNfOption) >>= defaultNfs >>= act >>= exitWith . exitCodeFor
   where act Options {modeFromOptions = VersionMode} = putStrLn ("hstest " ++ showVersion version) >> exitSuccess
                                 covert a
                                 return a
 
-resolvePropertyTester :: PropertyTester -> G.Ghc PropertyTester
-resolvePropertyTester = return
+resolvePropertyTester :: Maybe PropertyTester -> G.Ghc PropertyTester
+resolvePropertyTester = maybe (return QuickCheck1) return