diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Tests/Old.hs | 10 | ||||
-rw-r--r-- | tests/test-pandoc.hs | 5 |
2 files changed, 10 insertions, 5 deletions
diff --git a/tests/Tests/Old.hs b/tests/Tests/Old.hs index 01e4403fb..a16784889 100644 --- a/tests/Tests/Old.hs +++ b/tests/Tests/Old.hs @@ -3,7 +3,7 @@ module Tests.Old (tests) where import Test.Framework (testGroup, Test ) import Test.Framework.Providers.HUnit import Test.HUnit ( assertBool ) - +import System.Environment ( getArgs ) import System.IO ( openTempFile, stderr ) import System.Process ( runProcess, waitForProcess ) import System.FilePath ( (</>), (<.>) ) @@ -22,9 +22,6 @@ import Text.Printf readFileUTF8 :: FilePath -> IO String readFileUTF8 f = B.readFile f >>= return . toStringLazy -pandocPath :: FilePath -pandocPath = ".." </> "dist" </> "build" </> "pandoc" </> "pandoc" - data TestResult = TestPassed | TestError ExitCode | TestFailed String FilePath [Diff String] @@ -209,6 +206,11 @@ testWithNormalize :: (String -> String) -- ^ Normalize function for output -> FilePath -- ^ Norm (for test results) filepath -> Test testWithNormalize normalizer testname opts inp norm = testCase testname $ do + args <- getArgs + let buildDir = case args of + (x:_) -> ".." </> x + _ -> error "test-pandoc: missing buildDir argument" + let pandocPath = buildDir </> "pandoc" </> "pandoc" (outputPath, hOut) <- openTempFile "" "pandoc-test" let inpPath = inp let normPath = norm diff --git a/tests/test-pandoc.hs b/tests/test-pandoc.hs index 67ca5eae2..ae521541a 100644 --- a/tests/test-pandoc.hs +++ b/tests/test-pandoc.hs @@ -38,4 +38,7 @@ tests = [ testGroup "Old" Tests.Old.tests main :: IO () main = do setLocaleEncoding utf8 - inDirectory "tests" $ defaultMain tests + -- we ignore command-line arguments, since we're having cabal pass + -- the build directory as first argument, and we don't want test-framework + -- to choke on that. + inDirectory "tests" $ defaultMainWithArgs tests [] |