Commit d70d9ead authored by Steffen Michels's avatar Steffen Michels

Merge branch 'add-without_default_imports-support' into 'master'

Add "without default imports" support

See merge request !4
parents cda8a53e c016272f
Pipeline #34199 failed with stage
in 4 minutes and 27 seconds
......@@ -54,6 +54,9 @@ Some imports are included automatically and do not need to be added here:
\item The tested module itself.
\end{itemize}
To prevent these modules from being imported, add \clean{without default imports} on the same line as \clean{@property-bootstrap}.
With this option, no modules are imported by default whatsoever.
\subsection{Advanced properties}
\subsubsection{\clean{@invariant}}
......
......@@ -322,13 +322,15 @@ where
coverage = toReal (length (filter (not o isEmpty) propsets)) / toReal (length fes + length ies)
tests = join "\n\n"
[ "module " +++ testmodname
, join "\n"
[ "import Gast, Gast.CommandLine"
, "from Testing.TestEvents import :: TestLocation{..}"
, "from StdString import instance toString {#Char}"
, "import Control.GenBimap"
, "import " +++ modname
]
, join "\n" $
if default_imports
[ "import Gast, Gast.CommandLine"
, "from Testing.TestEvents import :: TestLocation{..}"
, "from StdString import instance toString {#Char}"
, "import Control.GenBimap"
, "import " +++ modname
]
[]
, bootstrap
, generators_string
, invariants
......@@ -343,7 +345,13 @@ where
pvis = fromMaybe [] $ docPropertyTestWith <$> mod_doc
props = flatten propsets
bootstrap = fromMaybe "" (docPropertyBootstrap =<< mod_doc)
(bootstrap,default_imports) = case docPropertyBootstrap =<< mod_doc of
Nothing ->
("",True)
Just bs=:{bootstrap_content=MultiLine content} ->
( content
, not bs.bootstrap_without_default_imports
)
invariants = join "\n\n" $ concatMap (\(_,td) -> map invariant td.TypeDoc.invariants) tes
where
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment