Commit 4ea94c45 authored by Edward Z. Yang's avatar Edward Z. Yang
Browse files

Test for copy --assume-deps-up-to-date


Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
parent f77dc3aa
......@@ -90,6 +90,8 @@ extra-source-files:
tests/PackageTests/Configure/A.hs
tests/PackageTests/Configure/Setup.hs
tests/PackageTests/Configure/X11.cabal
tests/PackageTests/CopyAssumeDepsUpToDate/CopyAssumeDepsUpToDate.cabal
tests/PackageTests/CopyAssumeDepsUpToDate/Main.hs
tests/PackageTests/CopyComponent/Exe/Main.hs
tests/PackageTests/CopyComponent/Exe/Main2.hs
tests/PackageTests/CopyComponent/Exe/myprog.cabal
......
name: CopyAssumeDepsUpToDate
version: 0.1.0.0
license: BSD3
author: Edward Z. Yang
maintainer: ezyang@cs.stanford.edu
build-type: Simple
cabal-version: >=1.10
data-files: data
executable myprog
main-is: Main.hs
other-modules: Paths_CopyAssumeDepsUpToDate
build-depends: base
default-language: Haskell2010
module Main where
import Paths_CopyAssumeDepsUpToDate
main :: IO ()
main = do
data_fn <- getDataFileName "data"
putStrLn data_fn -- for debugging
data_contents <- readFile data_fn
putStrLn data_contents
......@@ -423,6 +423,25 @@ tests config = do
runExe' "myprog" []
>>= assertOutputContains "a1 b2"
-- Test copy --assume-deps-up-to-date
tc "CopyAssumeDepsUpToDate" $ do
withPackageDb $ do
cabal_build []
pkg_dir <- packageDir
shouldFail (runExe' "myprog" [])
>>= assertOutputContains "does not exist"
prefix_dir <- prefixDir
shouldNotExist $ prefix_dir </> "bin" </> "myprog"
liftIO $ writeFile (pkg_dir </> "data") "aaa"
cabal "copy" ["--assume-deps-up-to-date"]
shouldNotExist $ prefix_dir </> "bin" </> "myprog"
runExe' "myprog" []
>>= assertOutputContains "aaa"
liftIO $ writeFile (pkg_dir </> "data") "bbb"
cabal "copy" ["--assume-deps-up-to-date", "myprog"]
runInstalledExe' "myprog" []
>>= assertOutputContains "aaa"
where
ghc_pkg_guess bin_name = do
cwd <- packageDir
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment