hark-0.2: test/Tester.hs
{-----------------------------------------------------------------
simple wrapper which runs through all the available tests
and returns the proper exit code to the shell
(c) 2008 Markus Dittrich
This program is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public
License Version 3 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License Version 3 for more details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
--------------------------------------------------------------------}
-- imports
import Prelude
import System.Exit
-- local imports
import ContentParserTest
import DependParserTest
import Helpers.PrettyPrint
import TestHelpers
import VersionParserTest
main :: IO ()
main = do
-- run the dependency tests
putColorStrLn Cyan $ "Testing depend parsing .....\n"
dependResult <- depend_tester
putColorStr Cyan $ "Summary result for depend parsing ....."
if dependResult
then
print_success
else
print_failure
-- run the dependency tests with USE flags taken into
-- consideration
putStrLn "\n\n"
putColorStrLn Cyan $ "Testing USE depend parsing .....\n"
dependUseResult <- depend_use_tester
putColorStr Cyan $ "Summary result for USEd depend parsing ....."
if dependUseResult
then
print_success
else
print_failure
-- run the version string parsing tests
putStrLn "\n\n"
putColorStrLn Cyan $ "Testing version string parsing .....\n"
versionParseResult <- version_parse_tester
putColorStr Cyan $ "Summary result for version string "
putColorStr Cyan $ "parsing ....."
if versionParseResult
then
print_success
else
print_failure
-- run the version string comparison tests
putStrLn "\n\n"
putColorStr Cyan $ "Testing comparing of version "
putColorStrLn Cyan $ "strings .....\n"
versionCompResult <- version_compare_tester
putColorStr Cyan $ "Summary result for comparing version "
putColorStr Cyan $ "strings ....."
if versionCompResult
then
print_success
else
print_failure
-- run the contenst parser tests
putStrLn "\n\n"
putColorStrLn Cyan $ "Testing content parsing "
contentCompResult <- content_tester
putColorStr Cyan $ "Summary result for comparing version "
putColorStr Cyan $ "strings ....."
if contentCompResult
then
print_success
else
print_failure
-- return proper exit status depending on test results
if (dependResult && dependUseResult && versionParseResult
&& versionCompResult)
then
exitWith ExitSuccess
else
exitWith $ ExitFailure 1