git.iko.soy/typeable/haskell-stack-trace-plugin
on master help sign in
Add integration test
e5412b8waddlaw
haskell-stack-trace-plugin.cabal+22
@@ -44,6 +44,28 @@ library
44 ghc-options: -O2 -Wall
44 ghc-options: -O2 -Wall
45 default-language: Haskell2010
45 default-language: Haskell2010
46
46
47+test-suite test
48+ main-is: Spec.hs
49+ hs-source-dirs: test
50+ type: exitcode-stdio-1.0
51+ build-depends:
52+ base >=4.12 && <4.13,
53+ bytestring >= 0.10.8 && <0.11,
54+ hspec >= 2.7 && <2.8,
55+ typed-process >= 0.2.6 && <0.2.9
56+
57+ build-tool-depends:
58+ hspec-discover:hspec-discover >= 2.7 && <2.8
59+
60+ other-modules: StackTrace.PluginSpec
61+
62+ if flag(dev)
63+ ghc-options: -Wall -Werror
64+ else
65+ ghc-options: -O2 -Wall
66+
67+ default-language: Haskell2010
68+
47executable example
69executable example
48 main-is: Main.hs
70 main-is: Main.hs
49 hs-source-dirs: example
71 hs-source-dirs: example
test/Spec.hsnew file+1
@@ -0,0 +1 @@
1+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
test/StackTrace/PluginSpec.hsnew file+21
@@ -0,0 +1,21 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+module StackTrace.PluginSpec (spec) where
3+
4+import Data.ByteString.Lazy (ByteString)
5+import qualified Data.ByteString.Lazy as BL
6+import Test.Hspec
7+import System.Process.Typed
8+
9+spec :: Spec
10+spec = do
11+ output <- runIO exe
12+ expected <- runIO $ BL.readFile "test/resource/ghc86.output"
13+ it "integration test" $ output `shouldBe` expected
14+
15+
16+exe :: IO ByteString
17+exe = do
18+ runProcess_ $ shell "cabal install exe:example --installdir=./dist"
19+ err <- readProcessStderr_ $ shell "./dist/example || true"
20+ runProcess_ $ shell "rm -rf ./dist"
21+ return err
test/resource/ghc86.outputnew file+13
@@ -0,0 +1,13 @@
1+example: fError
2+CallStack (from HasCallStack):
3+ error, called at example/Main.hs:41:10 in main:Main
4+ fError, called at example/Main.hs:37:11 in main:Main
5+ f8, called at example/Main.hs:33:16 in main:Main
6+ f7, called at example/Main.hs:29:11 in main:Main
7+ f6, called at example/Main.hs:25:15 in main:Main
8+ f5, called at example/Main.hs:21:8 in main:Main
9+ f4, called at example/Main.hs:17:6 in main:Main
10+ f3, called at example/Main.hs:13:6 in main:Main
11+ f2, called at example/Main.hs:10:6 in main:Main
12+ f1, called at example/Main.hs:7:14 in main:Main
13+ main, called at example/Main.hs:7:1 in main:Main