Skip to content

Commit

Permalink
Add integration test for package location in deps
Browse files Browse the repository at this point in the history
  • Loading branch information
akshaymankar committed Jun 15, 2019
1 parent c230035 commit 748d3c4
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 40 deletions.
111 changes: 72 additions & 39 deletions test/integration/tests/4101-dependency-tree/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,75 @@ main = do
, "│ │ │ └─┬ ghc-prim 0.5.1.1"
, "│ │ │ └── rts 1.0"
, "│ │ └── rts 1.0"
, "│ ├─┬ filelock 0.1.1.2"
, "│ │ ├─┬ base 4.10.1.0"
, "│ │ │ ├─┬ ghc-prim 0.5.1.1"
, "│ │ │ │ └── rts 1.0"
, "│ │ │ ├─┬ integer-gmp 1.0.1.0"
, "│ │ │ │ └─┬ ghc-prim 0.5.1.1"
, "│ │ │ │ └── rts 1.0"
, "│ │ │ └── rts 1.0"
, "│ │ └─┬ unix 2.7.2.2"
, "│ │ ├─┬ base 4.10.1.0"
, "│ │ │ ├─┬ ghc-prim 0.5.1.1"
, "│ │ │ │ └── rts 1.0"
, "│ │ │ ├─┬ integer-gmp 1.0.1.0"
, "│ │ │ │ └─┬ ghc-prim 0.5.1.1"
, "│ │ │ │ └── rts 1.0"
, "│ │ │ └── rts 1.0"
, "│ │ ├─┬ bytestring 0.10.8.2"
, "│ │ │ ├─┬ base 4.10.1.0"
, "│ │ │ │ ├─┬ ghc-prim 0.5.1.1"
, "│ │ │ │ │ └── rts 1.0"
, "│ │ │ │ ├─┬ integer-gmp 1.0.1.0"
, "│ │ │ │ │ └─┬ ghc-prim 0.5.1.1"
, "│ │ │ │ │ └── rts 1.0"
, "│ │ │ │ └── rts 1.0"
, "│ │ │ ├─┬ deepseq 1.4.3.0"
, "│ │ │ │ ├─┬ array 0.5.2.0"
, "│ │ │ │ │ └─┬ base 4.10.1.0"
, "│ │ │ │ │ ├─┬ ghc-prim 0.5.1.1"
, "│ │ │ │ │ │ └── rts 1.0"
, "│ │ │ │ │ ├─┬ integer-gmp 1.0.1.0"
, "│ │ │ │ │ │ └─┬ ghc-prim 0.5.1.1"
, "│ │ │ │ │ │ └── rts 1.0"
, "│ │ │ │ │ └── rts 1.0"
, "│ │ │ │ └─┬ base 4.10.1.0"
, "│ │ │ │ ├─┬ ghc-prim 0.5.1.1"
, "│ │ │ │ │ └── rts 1.0"
, "│ │ │ │ ├─┬ integer-gmp 1.0.1.0"
, "│ │ │ │ │ └─┬ ghc-prim 0.5.1.1"
, "│ │ │ │ │ └── rts 1.0"
, "│ │ │ │ └── rts 1.0"
, "│ │ │ ├─┬ ghc-prim 0.5.1.1"
, "│ │ │ │ └── rts 1.0"
, "│ │ │ └─┬ integer-gmp 1.0.1.0"
, "│ │ │ └─┬ ghc-prim 0.5.1.1"
, "│ │ │ └── rts 1.0"
, "│ │ └─┬ time 1.8.0.2"
, "│ │ ├─┬ base 4.10.1.0"
, "│ │ │ ├─┬ ghc-prim 0.5.1.1"
, "│ │ │ │ └── rts 1.0"
, "│ │ │ ├─┬ integer-gmp 1.0.1.0"
, "│ │ │ │ └─┬ ghc-prim 0.5.1.1"
, "│ │ │ │ └── rts 1.0"
, "│ │ │ └── rts 1.0"
, "│ │ └─┬ deepseq 1.4.3.0"
, "│ │ ├─┬ array 0.5.2.0"
, "│ │ │ └─┬ base 4.10.1.0"
, "│ │ │ ├─┬ ghc-prim 0.5.1.1"
, "│ │ │ │ └── rts 1.0"
, "│ │ │ ├─┬ integer-gmp 1.0.1.0"
, "│ │ │ │ └─┬ ghc-prim 0.5.1.1"
, "│ │ │ │ └── rts 1.0"
, "│ │ │ └── rts 1.0"
, "│ │ └─┬ base 4.10.1.0"
, "│ │ ├─┬ ghc-prim 0.5.1.1"
, "│ │ │ └── rts 1.0"
, "│ │ ├─┬ integer-gmp 1.0.1.0"
, "│ │ │ └─┬ ghc-prim 0.5.1.1"
, "│ │ │ └── rts 1.0"
, "│ │ └── rts 1.0"
, "│ ├─┬ mtl 2.2.2"
, "│ │ ├─┬ base 4.10.1.0"
, "│ │ │ ├─┬ ghc-prim 0.5.1.1"
Expand Down Expand Up @@ -53,6 +122,7 @@ main = do
let expected = unlines [ "Packages"
, "├─┬ files 0.1.0.0"
, "│ ├── base 4.10.1.0"
, "│ ├── filelock 0.1.1.2"
, "│ ├── mtl 2.2.2"
, "│ └── subproject 0.1.0.0"
, "└─┬ subproject 0.1.0.0"
Expand All @@ -61,7 +131,7 @@ main = do
when (stdOut /= expected) $
error $ unlines [ "Expected:", expected, "Actual:", stdOut ]

stackCheckStdout ["ls", "dependencies", "--tree", "subproject"] $ \stdOut -> do
stackCheckStdout ["ls", "dependencies", "tree", "subproject"] $ \stdOut -> do
let expected = unlines [ "Packages"
, "└─┬ subproject 0.1.0.0"
, " └─┬ base 4.10.1.0"
Expand All @@ -76,43 +146,6 @@ main = do
error $ unlines [ "Expected:", expected, "Actual:", stdOut ]

stackCheckStdout ["ls", "dependencies", "json"] $ \stdOut -> do
let expected = unlines [ "["
, " {"
, " \"name\": \"transformers\","
, " \"version\": \"0.5.2.0\","
, " \"license\": \"BSD3\""
, " },"
, " {"
, " \"name\": \"rts\","
, " \"version\": \"1.0\","
, " \"license\": \"BSD3\""
, " },"
, " {"
, " \"name\": \"mtl\","
, " \"version\": \"2.2.2\","
, " \"license\": \"BSD3\""
, " },"
, " {"
, " \"name\": \"integer-gmp\","
, " \"version\": \"1.0.1.0\","
, " \"license\": \"BSD3\""
, " },"
, " {"
, " \"name\": \"ghc-prim\","
, " \"version\": \"0.5.1.1\","
, " \"license\": \"BSD3\""
, " },"
, " {"
, " \"name\": \"files\","
, " \"version\": \"0.1.0.0\","
, " \"license\": \"AllRightsReserved\""
, " },"
, " {"
, " \"name\": \"base\","
, " \"version\": \"4.10.1.0\","
, " \"license\": \"BSD3\""
, " }"
, "]"
]
let expected = "[{\"name\":\"unix\",\"version\":\"2.7.2.2\",\"license\":\"BSD3\"},{\"name\":\"transformers\",\"version\":\"0.5.2.0\",\"license\":\"BSD3\"},{\"name\":\"time\",\"version\":\"1.8.0.2\",\"license\":\"BSD3\"},{\"location\":{\"url\":\"file:///Users/axeman/work/stack/test/integration/tests/4101-dependency-tree/files/subproject/\",\"type\":\"project package\"},\"name\":\"subproject\",\"version\":\"0.1.0.0\",\"license\":\"AllRightsReserved\"},{\"name\":\"rts\",\"version\":\"1.0\",\"license\":\"BSD3\"},{\"location\":{\"url\":\"https://hackage.haskell.org/package/mtl-2.2.2\",\"type\":\"hackage\"},\"name\":\"mtl\",\"version\":\"2.2.2\",\"license\":\"BSD3\"},{\"name\":\"integer-gmp\",\"version\":\"1.0.1.0\",\"license\":\"BSD3\"},{\"name\":\"ghc-prim\",\"version\":\"0.5.1.1\",\"license\":\"BSD3\"},{\"location\":{\"url\":\"file:///Users/axeman/work/stack/test/integration/tests/4101-dependency-tree/files/\",\"type\":\"project package\"},\"name\":\"files\",\"version\":\"0.1.0.0\",\"license\":\"AllRightsReserved\"},{\"location\":{\"subdir\":\"\",\"url\":\"[email protected]:snoyberg/filelock\",\"type\":\"git\",\"commit\":\"4f080496d8bf153fbe26e64d1f52cf73c7db25f6\"},\"name\":\"filelock\",\"version\":\"0.1.1.2\",\"license\":\"PublicDomain\"},{\"name\":\"deepseq\",\"version\":\"1.4.3.0\",\"license\":\"BSD3\"},{\"name\":\"bytestring\",\"version\":\"0.10.8.2\",\"license\":\"BSD3\"},{\"name\":\"base\",\"version\":\"4.10.1.0\",\"license\":\"BSD3\"},{\"name\":\"array\",\"version\":\"0.5.2.0\",\"license\":\"BSD3\"}]\n"
when (stdOut /= expected) $
error $ unlines [ "Expected:", expected, "Actual:", stdOut ]
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ cabal-version: >=1.10
library
hs-source-dirs: src
exposed-modules: Lib
build-depends: base >= 4.7 && < 5, mtl, subproject
build-depends: base >= 4.7 && < 5, mtl, subproject, filelock
default-language: Haskell2010
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
Expand Up @@ -2,3 +2,6 @@ resolver: lts-11.22
packages:
- .
- subproject
extra-deps:
- git: [email protected]:snoyberg/filelock
commit: 4f080496d8bf153fbe26e64d1f52cf73c7db25f6

0 comments on commit 748d3c4

Please sign in to comment.