refactor
This commit is contained in:
parent
11b43b3a2a
commit
a7d2ed8c21
@ -210,12 +210,18 @@ data LineSource m = LineSource (Source m Text) FilePath Int
|
|||||||
|
|
||||||
geval :: GEvalSpecification -> IO (MetricValue)
|
geval :: GEvalSpecification -> IO (MetricValue)
|
||||||
geval gevalSpec = do
|
geval gevalSpec = do
|
||||||
|
(inputFilePath, expectedFilePath, outFilePath) <- checkAndGetFiles gevalSpec
|
||||||
|
gevalCore metric inputFilePath expectedFilePath outFilePath
|
||||||
|
where metric = gesMetric gevalSpec
|
||||||
|
|
||||||
|
checkAndGetFiles :: GEvalSpecification -> IO (FilePath, FilePath, FilePath)
|
||||||
|
checkAndGetFiles gevalSpec = do
|
||||||
unlessM (D.doesDirectoryExist outDirectory) $ throwM $ NoOutDirectory outDirectory
|
unlessM (D.doesDirectoryExist outDirectory) $ throwM $ NoOutDirectory outDirectory
|
||||||
unlessM (D.doesDirectoryExist expectedDirectory) $ throwM $ NoExpectedDirectory expectedDirectory
|
unlessM (D.doesDirectoryExist expectedDirectory) $ throwM $ NoExpectedDirectory expectedDirectory
|
||||||
unlessM (D.doesDirectoryExist outTestDirectory) $ throwM $ NoOutTestDirectory outTestDirectory
|
unlessM (D.doesDirectoryExist outTestDirectory) $ throwM $ NoOutTestDirectory outTestDirectory
|
||||||
unlessM (D.doesDirectoryExist expectedTestDirectory) $ throwM $ NoExpectedTestDirectory expectedTestDirectory
|
unlessM (D.doesDirectoryExist expectedTestDirectory) $ throwM $ NoExpectedTestDirectory expectedTestDirectory
|
||||||
checkInputFileIfNeeded metric inputFilePath
|
checkInputFileIfNeeded metric inputFilePath
|
||||||
gevalCore metric inputFilePath expectedFilePath outFilePath
|
return (inputFilePath expectedFilePath outFilePath)
|
||||||
where expectedFilePath = expectedTestDirectory </> (gesExpectedFile gevalSpec)
|
where expectedFilePath = expectedTestDirectory </> (gesExpectedFile gevalSpec)
|
||||||
outFilePath = outTestDirectory </> (gesOutFile gevalSpec)
|
outFilePath = outTestDirectory </> (gesOutFile gevalSpec)
|
||||||
inputFilePath = expectedTestDirectory </> (gesInputFile gevalSpec)
|
inputFilePath = expectedTestDirectory </> (gesInputFile gevalSpec)
|
||||||
|
Loading…
Reference in New Issue
Block a user