Skip to content
Snippets Groups Projects
Commit 1c0f9d12 authored by Iustin Pop's avatar Iustin Pop
Browse files

Remove duplicate test file functions


This patch unifies the functions that generated the tree
reorganisation discussion in the first place :)

Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 3e16567e
No related branches found
No related tags found
No related merge requests found
...@@ -43,7 +43,7 @@ import Ganeti.Block.Drbd.Types ...@@ -43,7 +43,7 @@ import Ganeti.Block.Drbd.Types
-- | Function for testing whether a file is parsed correctly. -- | Function for testing whether a file is parsed correctly.
testFile :: String -> DRBDStatus -> Assertion testFile :: String -> DRBDStatus -> Assertion
testFile fileName expectedContent = do testFile fileName expectedContent = do
fileContent <- readPythonTestData fileName fileContent <- readTestData fileName
case A.parseOnly drbdStatusParser $ pack fileContent of case A.parseOnly drbdStatusParser $ pack fileContent of
Left msg -> assertFailure $ "Parsing failed: " ++ msg Left msg -> assertFailure $ "Parsing failed: " ++ msg
Right obtained -> assertEqual fileName expectedContent obtained Right obtained -> assertEqual fileName expectedContent obtained
......
...@@ -289,14 +289,8 @@ testDataFilename datadir name = do ...@@ -289,14 +289,8 @@ testDataFilename datadir name = do
src <- getSourceDir src <- getSourceDir
return $ src ++ datadir ++ name 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. -- | Returns the content of the specified haskell test data file.
readTestData :: String -> IO String readTestData :: String -> IO String
readTestData filename = do readTestData filename = do
name <- testDataFilename "/test/data/htools/" filename name <- testDataFilename "/test/data/" filename
readFile name readFile name
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment