-
Notifications
You must be signed in to change notification settings - Fork 691
/
Check.hs
24 lines (18 loc) · 1020 Bytes
/
Check.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module PackageTests.BuildDeps.InternalLibrary3.Check where
import Test.HUnit
import PackageTests.PackageTester
import System.FilePath
import qualified Data.ByteString.Char8 as C
suite :: Test
suite = TestCase $ do
let spec = PackageSpec ("PackageTests" </> "BuildDeps" </> "InternalLibrary3") []
let specTI = PackageSpec (directory spec </> "to-install") []
unregister "InternalLibrary3"
iResult <- cabal_install specTI
assertEqual "cabal install should succeed - see to-install/test-log.txt" True (successful iResult)
bResult <- cabal_build spec
assertEqual "cabal build should succeed - see test-log.txt" True (successful bResult)
unregister "InternalLibrary3"
(_, _, output) <- run (Just $ directory spec) "dist/build/lemon/lemon" []
C.appendFile (directory spec </> "test-log.txt") (C.pack $ "\ndist/build/lemon/lemon\n"++output)
assertEqual "executable should have linked with the internal library" "myLibFunc internal" (concat $ lines output)