Skip to content

Commit 78f3998

Browse files
committed
Add integration test
1 parent 1037447 commit 78f3998

File tree

7 files changed

+53
-0
lines changed

7 files changed

+53
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import Control.Monad (unless)
2+
import Data.List (isInfixOf)
3+
import StackTest
4+
5+
main :: IO ()
6+
main = do
7+
stack ["clean"]
8+
stack ["build"]
9+
res <- compilingModulesLines . snd <$> stackStderr ["build"]
10+
unless (null res) $ fail "Stack recompiled code"
11+
12+
-- Returns the lines where a module is compiled
13+
compilingModulesLines :: String -> [String]
14+
compilingModulesLines = filter (isInfixOf " Compiling ") . lines
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import Distribution.Simple
2+
main = defaultMain
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: files
2+
version: 0.1.0.0
3+
build-type: Simple
4+
cabal-version: >= 2.0
5+
6+
library
7+
hs-source-dirs: src
8+
exposed-modules: Lib
9+
build-depends: base, lib
10+
default-language: Haskell2010
11+
12+
library lib
13+
hs-source-dirs: src-internal
14+
exposed-modules: Internal
15+
build-depends: base
16+
default-language: Haskell2010
17+
18+
executable exe
19+
hs-source-dirs: src-exe
20+
main-is: Main.hs
21+
build-depends: base, files
22+
default-language: Haskell2010
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module Main where
2+
3+
import Lib
4+
5+
main :: IO ()
6+
main = do
7+
putStrLn "hello world"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module Internal where
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module Lib where
2+
3+
import Internal
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
resolver: ghc-8.2.2
2+
extra-deps:
3+
- stm-2.4.4.1
4+
- mtl-2.2.1

0 commit comments

Comments
 (0)