Skip to content

Commit

Permalink
Adds integration test for commercialhaskell#3396
Browse files Browse the repository at this point in the history
The provided test package (dinamo), that is part of a custom snapshot has
a malformed cabal file. Specifically, it's setting the required cabal
version to an invalid number (9001). This test makes sure that
stack does not care about this if we do not actually use the package
in our project.
  • Loading branch information
denibertovic committed Oct 20, 2017
1 parent 0fa24c2 commit 516c382
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/integration/IntegrationSpec.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE ScopedTypeVariables #-}

import Control.Applicative
Expand All @@ -15,14 +15,14 @@ import Data.Conduit.Binary (sinkLbs)
import Data.Conduit.Filesystem (sourceDirectoryDeep)
import qualified Data.Conduit.List as CL
import Data.Conduit.Process
import Data.List (isSuffixOf, stripPrefix, sort)
import Data.List (isSuffixOf, sort, stripPrefix)
import qualified Data.Map as Map
import Data.Maybe (fromMaybe)
import Data.Text.Encoding.Error (lenientDecode)
import qualified Data.Text.Lazy as TL
import qualified Data.Text.Lazy.Encoding as TL
import Data.Typeable
import Prelude -- Fix redundant import warnings
import Prelude
import System.Directory
import System.Environment
import System.Exit
Expand All @@ -38,7 +38,7 @@ main = do
let findExe name = do
mexe <- findExecutable name
case mexe of
Nothing -> error $ name ++ " not found on PATH"
Nothing -> error $ name ++ " not found on PATH"
Just exe -> return exe
runghc <- findExe "runghc"
stack <- findExe "stack"
Expand Down Expand Up @@ -136,7 +136,7 @@ toCopyRoot srcfp = any (`isSuffixOf` srcfp)
-- copied, trade-off of runtime/bandwidth vs isolation of tests
[ ".tar"
, ".xz"
-- , ".gz"
, ".gz"
, ".7z.exe"
, "00-index.cache"
]
4 changes: 4 additions & 0 deletions test/integration/tests/3396-package-indices/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import StackTest

main :: IO ()
main = stack ["build"]
Binary file not shown.
Binary file not shown.
Binary file not shown.
19 changes: 19 additions & 0 deletions test/integration/tests/3396-package-indices/files/files.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: files
version: 0.1.0.0
-- synopsis:
-- description:
homepage: https://github.com/githubuser/files#readme
license: BSD3
author: Author name here
maintainer: example@example.com
copyright: 2017 Author name here
category: Web
build-type: Simple
cabal-version: >=1.10

library
hs-source-dirs: src
exposed-modules: Lib
build-depends: base >= 4.7 && < 5
default-language: Haskell2010

11 changes: 11 additions & 0 deletions test/integration/tests/3396-package-indices/files/my-snapshot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
compiler: ghc-8.0.2
name: my-snapshot

packages:
- base-4.10.0.0
- dinamo-0.1.0.0

flags:
dinamo:
debug: true

8 changes: 8 additions & 0 deletions test/integration/tests/3396-package-indices/files/src/Lib.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module Lib
( someFunc
) where


someFunc :: IO ()
someFunc = print "some func"

18 changes: 18 additions & 0 deletions test/integration/tests/3396-package-indices/files/stack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
resolver: my-snapshot.yaml

packages:
- .

extra-deps: []

# Override default flag values for local packages and extra-deps
flags: {}

# Extra package databases containing global packages
extra-package-dbs: []

package-indices:
- name: CustomIndex
download-prefix: http://0.0.0.0:8080/
http: http://0.0.0.0:8080/custom.index.tar.gz

0 comments on commit 516c382

Please sign in to comment.