Commit f2ead2e9 authored by Camil Staps's avatar Camil Staps 🚀

Merge branch 'testing-source-locations' into 'master'

Use module_and_name: keep track of source location

See merge request !1
parents d4bbcb2d e1d80280
Pipeline #28183 passed with stage
in 5 minutes and 32 seconds
......@@ -309,10 +309,13 @@ where
coverage = toReal (length (filter (not o isEmpty) propsets)) / toReal (length fes)
tests = join "\n\n"
[ "module " +++ testmodname
, "import Gast, Gast.CommandLine"
, "from StdString import instance toString {#Char}"
, "import Control.GenBimap"
, "import " +++ modname
, join "\n"
[ "import Gast, Gast.CommandLine"
, "from Testing.TestEvents import :: TestLocation{..}"
, "from StdString import instance toString {#Char}"
, "import Control.GenBimap"
, "import " +++ modname
]
, bootstrap
, generators_string
, invariants
......@@ -320,7 +323,7 @@ where
: [gp.gp_implementation \\ gp <- props]
]
propsets = map (uncurry $ generateProperties pvis generators) fes
propsets = map (uncurry $ generateProperties modname pvis generators) fes
where pvis = fromMaybe [] $ docPropertyTestWith <$> mod_doc
props = flatten propsets
......@@ -375,8 +378,8 @@ where
, ga_ptg :: !Maybe NamedTestGenerator // the generator used
}
generateProperties :: ![PropertyVarInstantiation] ![NamedTestGenerator] !String !FunctionDoc -> [GeneratedProperty]
generateProperties pvis generators fname doc =
generateProperties :: !String ![PropertyVarInstantiation] ![NamedTestGenerator] !String !FunctionDoc -> [GeneratedProperty]
generateProperties modname pvis generators fname doc =
[gen i fname doc.preconditions p config
\\ p <- doc.properties
, config <- configurationsForProperty p (pvis ++ docPropertyTestWith doc)
......@@ -402,7 +405,7 @@ where
{ gp_name = tname
, gp_implementation = join "\n"
[ tname +++ " :: Property"
, tname +++ " = name \"" +++ fname +++ ": " +++ name` +++ "\""
, tname +++ " = location_and_name {moduleName=Just \"" +++ modname +++ "\"} \"" +++ fname +++ ": " +++ name` +++ "\""
, "\t(" +++ join " " lambdas +++ join " " [name`` +++ "`":[ga.ga_expr \\ ga <- gas]] +++ {')' \\ _ <- lambdas} +++ ")"
, "where"
, "\t" +++ name`` +++ "` :: " +++ toString type`
......
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