Commit b3e38b36 authored by Michael Hanus 's avatar Michael Hanus
Browse files

currycheck bug with import qualifications fixed

parent 748399bd
...@@ -24,6 +24,7 @@ import AbstractCurry.Pretty (showCProg) ...@@ -24,6 +24,7 @@ import AbstractCurry.Pretty (showCProg)
import AbstractCurry.Transform (renameCurryModule) import AbstractCurry.Transform (renameCurryModule)
import AnsiCodes import AnsiCodes
import Distribution import Distribution
import FilePath ((</>))
import qualified FlatCurry.Types as FC import qualified FlatCurry.Types as FC
import FlatCurry.Files import FlatCurry.Files
import qualified FlatCurry.Goodies as FCG import qualified FlatCurry.Goodies as FCG
...@@ -44,7 +45,7 @@ ccBanner :: String ...@@ -44,7 +45,7 @@ ccBanner :: String
ccBanner = unlines [bannerLine,bannerText,bannerLine] ccBanner = unlines [bannerLine,bannerText,bannerLine]
where where
bannerText = bannerText =
"CurryCheck: a tool for testing Curry programs (version of 03/03/2016)" "CurryCheck: a tool for testing Curry programs (version of 14/03/2016)"
bannerLine = take (length bannerText) (repeat '-') bannerLine = take (length bannerText) (repeat '-')
-- Help text -- Help text
...@@ -525,7 +526,7 @@ genSpecTest prefuns specops (CFunc qf@(mn,fn) ar _ texp _) = ...@@ -525,7 +526,7 @@ genSpecTest prefuns specops (CFunc qf@(mn,fn) ar _ texp _) =
[CFunc (mn, fn ++ satSpecSuffix) ar Public [CFunc (mn, fn ++ satSpecSuffix) ar Public
(propResultType texp) (propResultType texp)
[simpleRule (map CPVar cvars) $ [simpleRule (map CPVar cvars) $
addPreCond (applyF (pre "<~>") addPreCond (applyF (easyCheckModule,"<~>")
[applyF qf (map CVar cvars), [applyF qf (map CVar cvars),
applyF (mn,fn++"'spec") (map CVar cvars)])]] applyF (mn,fn++"'spec") (map CVar cvars)])]]
where where
...@@ -716,7 +717,8 @@ genMainTestModule opts mainmodname modules = do ...@@ -716,7 +717,8 @@ genMainTestModule opts mainmodname modules = do
imports = nub $ [easyCheckModule, searchTreeModule, generatorModule, imports = nub $ [easyCheckModule, searchTreeModule, generatorModule,
"AnsiCodes","Maybe","System"] ++ "AnsiCodes","Maybe","System"] ++
map fst testtypes ++ map testModuleName modules map fst testtypes ++ map testModuleName modules
appendix <- readFile (installDir ++ "/currytools/currycheck/TestApp.curry") appendix <- readFile (installDir </> "currytools" </> "currycheck"
</> "TestAppendix.curry")
writeCurryProgram (CurryProg mainmodname imports [] (mainFunction : funcs) []) writeCurryProgram (CurryProg mainmodname imports [] (mainFunction : funcs) [])
appendix appendix
...@@ -796,7 +798,7 @@ cleanup opts mainmodname modules = ...@@ -796,7 +798,7 @@ cleanup opts mainmodname modules =
mapIO_ removeCurryModule (map testModuleName modules) mapIO_ removeCurryModule (map testModuleName modules)
where where
removeCurryModule modname = do removeCurryModule modname = do
system $ installDir ++ "/bin/cleancurry " ++ modname system $ installDir </> "bin" </> "cleancurry" ++ " " ++ modname
system $ "rm -f " ++ modname ++ ".curry" system $ "rm -f " ++ modname ++ ".curry"
-- Show some statistics about number of tests: -- Show some statistics about number of tests:
...@@ -836,9 +838,10 @@ main = do ...@@ -836,9 +838,10 @@ main = do
"Generating main test module '"++testmodname++"'..." "Generating main test module '"++testmodname++"'..."
genMainTestModule opts testmodname finaltestmodules genMainTestModule opts testmodname finaltestmodules
putStrIfNormal opts $ withColor opts blue $ "and compiling it...\n" putStrIfNormal opts $ withColor opts blue $ "and compiling it...\n"
ret <- system $ unwords $ ret <- system $ unwords $ [installDir </> "bin" </> "curry"
[installDir++"/bin/curry",":set v0",":set parser -Wnone", ,":set v0"
":l "++testmodname,":eval main :q"] ,":set parser -Wnone"
,":l "++testmodname,":eval main :q"]
cleanup opts testmodname finaltestmodules cleanup opts testmodname finaltestmodules
unless (isQuiet opts || ret /= 0) $ unless (isQuiet opts || ret /= 0) $
putStrLn $ withColor opts green $ showTestStatistics finaltestmodules putStrLn $ withColor opts green $ showTestStatistics finaltestmodules
......
------------------------------------------------------------------------- -------------------------------------------------------------------------
-- Some definitions added to the main test module generated by CurryCheck. --- Some definitions added as an appendix to the main test module
--- generated by CurryCheck.
--- Runs a sequence of property tests. Outputs the messages of the failed tests --- Runs a sequence of property tests. Outputs the messages of the failed tests
--- messages and returns exit status 0 if all tests are successful, --- messages and returns exit status 0 if all tests are successful,
--- otherwise status 1. --- otherwise status 1.
runPropertyTests :: Bool -> [IO (Maybe String)] -> IO Int runPropertyTests :: Bool -> [IO (Maybe String)] -> IO Int
runPropertyTests withcolor props = do runPropertyTests withcolor props = do
failedmsgs <- sequenceIO props >>= return . catMaybes failedmsgs <- sequenceIO props >>= return . Maybe.catMaybes
if null failedmsgs if null failedmsgs
then return 0 then return 0
else do putStrLn $ (if withcolor then red else id) $ else do putStrLn $ (if withcolor then AnsiCodes.red else id) $
line ++ line ++
"\nFAILURES OCCURRED IN SOME TESTS:\n" ++ "\nFAILURES OCCURRED IN SOME TESTS:\n" ++
unlines failedmsgs ++ line unlines failedmsgs ++ line
......
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