Skip to content

Commit

Permalink
Add integration test for printing dependency tree
Browse files Browse the repository at this point in the history
  • Loading branch information
akshaymankar committed Oct 21, 2018
1 parent 3d72209 commit f466a19
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
36 changes: 36 additions & 0 deletions test/integration/tests/4101-dependency-tree/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import Control.Monad (when)
import StackTest

main :: IO ()
main = do
stackCheckStdout ["ls", "dependencies", "--tree"] $ \stdOut -> do
let expected = unlines [ "Packages"
, "└─┬ files mkVersion [0,1,0,0]"
, " ├─┬ base mkVersion [4,11,1,0]"
, " │ ├─┬ ghc-prim mkVersion [0,5,2,0]"
, " │ │ └── rts mkVersion [1,0]"
, " │ ├─┬ integer-gmp mkVersion [1,0,2,0]"
, " │ │ └─┬ ghc-prim mkVersion [0,5,2,0]"
, " │ │ └── rts mkVersion [1,0]"
, " │ └── rts mkVersion [1,0]"
, " └─┬ mtl mkVersion [2,2,2]"
, " ├─┬ base mkVersion [4,11,1,0]"
, " │ ├─┬ ghc-prim mkVersion [0,5,2,0]"
, " │ │ └── rts mkVersion [1,0]"
, " │ ├─┬ integer-gmp mkVersion [1,0,2,0]"
, " │ │ └─┬ ghc-prim mkVersion [0,5,2,0]"
, " │ │ └── rts mkVersion [1,0]"
, " │ └── rts mkVersion [1,0]"
, " └── transformers mkVersion [0,5,5,0]"
]
when (stdOut /= expected) $
error $ unlines [ "Expected:", expected, "Actual:", stdOut ]

stackCheckStdout ["ls", "dependencies", "--tree", "--depth=1"] $ \stdOut -> do
let expected = unlines [ "Packages"
, "└─┬ files mkVersion [0,1,0,0]"
, " ├── base mkVersion [4,11,1,0]"
, " └── mtl mkVersion [2,2,2]"
]
when (stdOut /= expected) $
error $ unlines [ "Expected:", expected, "Actual:", stdOut ]
10 changes: 10 additions & 0 deletions test/integration/tests/4101-dependency-tree/files/files.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: files
version: 0.1.0.0
build-type: Simple
cabal-version: >=1.10

library
hs-source-dirs: src
exposed-modules: Lib
build-depends: base >= 4.7 && < 5, mtl
default-language: Haskell2010
5 changes: 5 additions & 0 deletions test/integration/tests/4101-dependency-tree/files/src/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Main where

main :: IO ()
main = do
putStrLn "hello world"
3 changes: 3 additions & 0 deletions test/integration/tests/4101-dependency-tree/files/stack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
resolver: lts-12.14
packages:
- .

0 comments on commit f466a19

Please sign in to comment.