Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tests/integration/tests/111-custom-snapshot/Main.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
-- Stack should build a package when a custom snapshot is specified in the
-- project-level configuration file.
--
-- See: https://github.com/commercialhaskell/stack/issues/111

import StackTest

main :: IO ()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
myPackage.cabal
10 changes: 0 additions & 10 deletions tests/integration/tests/111-custom-snapshot/files/files.cabal

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
compiler: ghc-9.10.3
name: my-snapshot

compiler: ghc-9.10.3
packages:
- mtl-2.3.1
- acme-missiles-0.3
11 changes: 11 additions & 0 deletions tests/integration/tests/111-custom-snapshot/files/package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
spec-version: 0.36.0

name: myPackage
version: 0.1.0.0

dependencies:
- base
- acme-missiles

library:
source-dirs: src
9 changes: 3 additions & 6 deletions tests/integration/tests/111-custom-snapshot/files/src/Lib.hs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
module Lib
( someFunc
) where
( launchMissiles
) where

import Control.Monad.Reader ()

someFunc :: IO ()
someFunc = putStrLn "someFunc"
import Acme.Missiles ( launchMissiles )
49 changes: 27 additions & 22 deletions tests/integration/tests/32-unlisted-module/Main.hs
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
import Control.Concurrent
import StackTest
-- Stack should rebuild a package when files required for building are dirty,
-- even if the files are not listed in the package's Cabal file.
--
-- See: https://github.com/commercialhaskell/stack/issues/32

import Control.Concurrent ( threadDelay )
import StackTest

main :: IO ()
main = do
copy "src/Unlisted_OK.hs" "src/Unlisted.hs"
copy "embed_OK.txt" "embed.txt"
stack ["build"]
pause
copy "src/Unlisted_FAIL.hs" "src/Unlisted.hs"
stackErr ["build"]
pause
copy "src/Unlisted_OK.hs" "src/Unlisted.hs"
stack ["build"]
stack ["exec", "files-exe"]
pause
copy "embed_FAIL.txt" "embed.txt"
stack ["build"]
stackErr ["exec", "files-exe"]
pause
copy "embed_OK.txt" "embed.txt"
stack ["build"]
stack ["exec", "files-exe"]

pause = threadDelay 1000000
copy "app/Unlisted_OK.hs" "app/Unlisted.hs"
copy "embed_OK.txt" "embed.txt"
stack ["build"]
pause
copy "app/Unlisted_FAIL.hs" "app/Unlisted.hs"
stackErr ["build"]
pause
copy "app/Unlisted_OK.hs" "app/Unlisted.hs"
stack ["build"]
stack ["exec", "fail-if-fail"]
pause
copy "embed_FAIL.txt" "embed.txt"
stack ["build"]
stackErr ["exec", "fail-if-fail"]
pause
copy "embed_OK.txt" "embed.txt"
stack ["build"]
stack ["exec", "fail-if-fail"]
where
pause = threadDelay 1000000
3 changes: 2 additions & 1 deletion tests/integration/tests/32-unlisted-module/files/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
embed.txt
src/Unlisted.hs
app/Unlisted.hs
myPackage.cabal
16 changes: 16 additions & 0 deletions tests/integration/tests/32-unlisted-module/files/app/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE OverloadedStrings #-}

module Main where

import Control.Monad ( when )
import qualified Data.ByteString.Char8 as C8
import Data.FileEmbed ( embedFile )
import Unlisted ( unlistedFunc )

main :: IO ()
main = do
unlistedFunc
when ("FAIL" `C8.isPrefixOf` embedded) $ error "embedded contains FAIL"

embedded = $(embedFile "embed.txt")
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- | Version of Unlisted with a different export that causes Main to fail to
-- compile.
module Unlisted where
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- | Version of Unlisted that does not cause Main to fail to compile.
module Unlisted where

unlistedFunc :: IO ()
unlistedFunc = pure ()
17 changes: 0 additions & 17 deletions tests/integration/tests/32-unlisted-module/files/files.cabal

This file was deleted.

15 changes: 15 additions & 0 deletions tests/integration/tests/32-unlisted-module/files/package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
spec-version: 0.36.0

name: myPackage
version: 0.1.0.0

dependencies:
- base
- bytestring
- file-embed

executables:
fail-if-fail:
source-dirs: app
main: Main.hs
other-modules: []
16 changes: 0 additions & 16 deletions tests/integration/tests/32-unlisted-module/files/src/Main.hs

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

15 changes: 10 additions & 5 deletions tests/integration/tests/335-multi-package-flags/Main.hs
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import StackTest
-- Stack should be able to specify Cabal flags for all packages that have a
-- Cabal flag of the same name.
--
-- See: https://github.com/commercialhaskell/stack/issues/335

import StackTest

main :: IO ()
main = do
stackErr ["build"]
stack ["build", "--flag", "new-template:necessary"]
stackErr ["build"]
stack ["build", "--flag", "*:necessary"]
stackErr ["build"]
stack ["build", "--flag", "myPackage:necessary"]
stackErr ["build"]
stack ["build", "--flag", "*:necessary"]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
myPackage.cabal

This file was deleted.

19 changes: 19 additions & 0 deletions tests/integration/tests/335-multi-package-flags/files/package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
spec-version: 0.36.0

name: myPackage
version: 0.1.0.0

flags:
necessary:
description: The package will not build unless this flag is true.
manual: true
default: false

dependencies:
- base

library:
source-dirs: src
when:
- condition: flag(necessary)
cpp-options: -DWORK
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{-# LANGUAGE CPP #-}
module Lib
( someFunc
) where

someFunc :: IO ()
someFunc = putStrLn "someFunc"
module Lib where

-- Avoid problems with CPP and HLint
#ifndef __HLINT__
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
snapshot: lts-24.37
snapshot: ghc-9.10.3
11 changes: 7 additions & 4 deletions tests/integration/tests/345-override-bytestring/Main.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import StackTest
-- An extra-dep in a project-level configuration file should be able to shadow a
-- GHC boot package such as bytestring.
--
-- See: https://github.com/commercialhaskell/stack/issues/345

import StackTest

main :: IO ()
main = do
stack ["build", "--dry-run"] -- for useful error output
stack ["build"]
main = stack ["build"]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
myPackage.cabal
4 changes: 0 additions & 4 deletions tests/integration/tests/345-override-bytestring/files/Foo.hs

This file was deleted.

10 changes: 0 additions & 10 deletions tests/integration/tests/345-override-bytestring/files/foo.cabal

This file was deleted.

11 changes: 11 additions & 0 deletions tests/integration/tests/345-override-bytestring/files/package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
spec-version: 0.36.0

name: myPackage
version: 0.1.0.0

dependencies:
- base
- bytestring

library:
source-dirs: src
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Lib where

import Data.ByteString ()
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
snapshot: lts-24.37
snapshot: ghc-9.10.3

extra-deps:
- bytestring-0.11.5.4
- binary-0.8.9.0
# GHC 9.10.3 comes with bytestring-0.12.2.0
- bytestring-0.12.1.0
22 changes: 14 additions & 8 deletions tests/integration/tests/365-invalid-success/Main.hs
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import StackTest
-- If Stack fails to build a package once, it should fail to build it
-- (unchanged) a second time.
--
-- See: https://github.com/commercialhaskell/stack/issues/365

import StackTest

main :: IO ()
main = do
stackErr ["build"]
stackErr ["build"]
writeFile "app/Foo.hs" "module Foo where"
stack ["build"]
writeFile "app/Foo.hs" "module Foo wher e"
stackErr ["build"]
stackErr ["build"]
copy "src/Lib_FAIL.hs" "src/Lib.hs"
stackErr ["build"]
stackErr ["build"]
copy "src/Lib_OK.hs" "src/Lib.hs"
stack ["build"]
copy "src/Lib_FAIL.hs" "src/Lib.hs"
stackErr ["build"]
stackErr ["build"]
3 changes: 2 additions & 1 deletion tests/integration/tests/365-invalid-success/files/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
app/Foo.hs
src/Lib.hs
myPackage.cabal

This file was deleted.

13 changes: 13 additions & 0 deletions tests/integration/tests/365-invalid-success/files/package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
spec-version: 0.36.0

name: myPackage
version: 0.1.0.0

dependencies:
- base

library:
source-dirs: src
exposed-modules:
- Lib
other-modules: []
Loading
Loading