From 1c0f9d12a640d1e4eff308bc4d33c41130c7357b Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Wed, 26 Dec 2012 13:52:24 +0100 Subject: [PATCH] Remove duplicate test file functions This patch unifies the functions that generated the tree reorganisation discussion in the first place :) Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Guido Trotter <ultrotter@google.com> --- test/hs/Test/Ganeti/Block/Drbd/Parser.hs | 2 +- test/hs/Test/Ganeti/TestCommon.hs | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/test/hs/Test/Ganeti/Block/Drbd/Parser.hs b/test/hs/Test/Ganeti/Block/Drbd/Parser.hs index 17b098841..401f1ec35 100644 --- a/test/hs/Test/Ganeti/Block/Drbd/Parser.hs +++ b/test/hs/Test/Ganeti/Block/Drbd/Parser.hs @@ -43,7 +43,7 @@ import Ganeti.Block.Drbd.Types -- | Function for testing whether a file is parsed correctly. testFile :: String -> DRBDStatus -> Assertion testFile fileName expectedContent = do - fileContent <- readPythonTestData fileName + fileContent <- readTestData fileName case A.parseOnly drbdStatusParser $ pack fileContent of Left msg -> assertFailure $ "Parsing failed: " ++ msg Right obtained -> assertEqual fileName expectedContent obtained diff --git a/test/hs/Test/Ganeti/TestCommon.hs b/test/hs/Test/Ganeti/TestCommon.hs index 72ae311ac..6dcc8ada7 100644 --- a/test/hs/Test/Ganeti/TestCommon.hs +++ b/test/hs/Test/Ganeti/TestCommon.hs @@ -289,14 +289,8 @@ testDataFilename datadir name = do src <- getSourceDir return $ src ++ datadir ++ name --- | Returns the content of the specified python test data file. -readPythonTestData :: String -> IO String -readPythonTestData filename = do - name <- testDataFilename "/test/data/" filename - readFile name - -- | Returns the content of the specified haskell test data file. readTestData :: String -> IO String readTestData filename = do - name <- testDataFilename "/test/data/htools/" filename + name <- testDataFilename "/test/data/" filename readFile name -- GitLab