Skip to content

Commit

Permalink
Rename simple-properties to check-properties
Browse files Browse the repository at this point in the history
  • Loading branch information
phadej committed Jan 10, 2021
1 parent 28beb79 commit 8ba4427
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 20 deletions.
11 changes: 4 additions & 7 deletions cabal-docspec/MANUAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,11 @@ However, in this list we mostly only list and show the --option version of them.

: RTS options for GHCi process

**\--skip-properties**

: Skip properties.

**\--simple-properties**
**\--check-properties**

: Evaluate **prop> expr x y** using **quickCheck (expr x y)**.
Requires *QuickCheck* package in the plan.
Default **\--no-check-properties**.

**\--property-variables** *varlist*

Expand Down Expand Up @@ -427,9 +424,9 @@ Haddock (since version 2.13.0) has markup support for properties
cabal-docspec can verify properties with QuickCheck.
Note: this works somewhat differently than it does in Doctest.

By default properties are skipped. This is a **\--skip-properties** behaviour.
By default properties are not checked.
cabal-docspec has a simple mechanism to evaluate properties
enabled by **\--simple-properties**.
enabled by **\--check-properties**.
For it to work, the *QuickCheck* package has to be in the install plan.

A simple property looks like this:
Expand Down
11 changes: 4 additions & 7 deletions cabal-docspec/cabal-docspec.1
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,10 @@ Default is \f[B]* Hangs forever *\f[R].
\f[B]--ghci-rtsopts\f[R] \f[I]options\f[R]
RTS options for GHCi process
.TP
\f[B]--skip-properties\f[R]
Skip properties.
.TP
\f[B]--simple-properties\f[R]
\f[B]--check-properties\f[R]
Evaluate \f[B]prop> expr x y\f[R] using \f[B]quickCheck (expr x y)\f[R].
Requires \f[I]QuickCheck\f[R] package in the plan.
Default \f[B]--no-check-properties\f[R].
.TP
\f[B]--property-variables\f[R] \f[I]varlist\f[R]
Variables to quantify over in properties.
Expand Down Expand Up @@ -467,10 +465,9 @@ Haddock (since version 2.13.0) has markup support for properties
cabal-docspec can verify properties with QuickCheck.
Note: this works somewhat differently than it does in Doctest.
.PP
By default properties are skipped.
This is a \f[B]--skip-properties\f[R] behaviour.
By default properties are not checked.
cabal-docspec has a simple mechanism to evaluate properties enabled by
\f[B]--simple-properties\f[R].
\f[B]--check-properties\f[R].
For it to work, the \f[I]QuickCheck\f[R] package has to be in the
install plan.
.PP
Expand Down
4 changes: 2 additions & 2 deletions cabal-docspec/src/CabalDocspec/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,8 @@ findExtraPackages tracer plan = traverse $ \pn -> do

propPkgs :: DynOpts -> [PackageName]
propPkgs dynOpts = case optProperties dynOpts of
SkipProperties -> []
SimpleProperties -> [ mkPackageName "QuickCheck" ]
SkipProperties -> []
CheckProperties -> [ mkPackageName "QuickCheck" ]

manglePackageName :: C.PackageName -> String
manglePackageName = map fixchar . prettyShow where
Expand Down
6 changes: 3 additions & 3 deletions cabal-docspec/src/CabalDocspec/Opts.hs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ data StripComments = StripComments | DontStripComments deriving (Eq, Show)

data Properties
= SkipProperties
| SimpleProperties
| CheckProperties
deriving (Eq, Ord, Show)

data Phase
Expand Down Expand Up @@ -190,8 +190,8 @@ stripComsP = lastOpt <$> many (on <|> off) where

propertiesP :: O.Parser (Properties -> Properties)
propertiesP = lastOpt <$> many (skip <|> simple) where
skip = O.flag' SkipProperties $ O.long "skip-properties" <> O.help "Skip properties (default)"
simple = O.flag' SimpleProperties $ O.long "simple-properties" <> O.help "SImple properties: evaluate using quickCheck (prop expr)"
skip = O.flag' SkipProperties $ O.long "no-check-properties" <> O.help "Skip properties (default)"
simple = O.flag' CheckProperties $ O.long "check-properties" <> O.help "Check properties: evaluate using quickCheck (prop expr)"

extP :: O.Parser String
extP = O.strOption (O.short 'X' <> O.metavar "EXT" <> O.help "Extensions")
Expand Down
2 changes: 1 addition & 1 deletion cabal-docspec/src/CabalDocspec/Phase2.hs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ phase2 tracer dynOpts unitIds ghcInfo mbuildDir cabalCfg cwd extraEnv parsed = d
putWarning tracer WSkippedProperty $ prettyPos pos ++ " skipping " ++ expr
return (Left (acc <> mempty { sProperties = ssSkip }))

SimpleProperties -> do
CheckProperties -> do
let vars = exprVars expr `Set.intersection` optPropVariables dynOpts

let lambdaPrefix :: String
Expand Down

0 comments on commit 8ba4427

Please sign in to comment.