mirror of
https://github.com/typeable/haskell-stack-trace-plugin.git
synced 2024-09-17 15:07:15 +03:00
Add integration test
This commit is contained in:
parent
dd4f8dbfd0
commit
e5412b8cfd
@ -44,6 +44,28 @@ library
|
||||
ghc-options: -O2 -Wall
|
||||
default-language: Haskell2010
|
||||
|
||||
test-suite test
|
||||
main-is: Spec.hs
|
||||
hs-source-dirs: test
|
||||
type: exitcode-stdio-1.0
|
||||
build-depends:
|
||||
base >=4.12 && <4.13,
|
||||
bytestring >= 0.10.8 && <0.11,
|
||||
hspec >= 2.7 && <2.8,
|
||||
typed-process >= 0.2.6 && <0.2.9
|
||||
|
||||
build-tool-depends:
|
||||
hspec-discover:hspec-discover >= 2.7 && <2.8
|
||||
|
||||
other-modules: StackTrace.PluginSpec
|
||||
|
||||
if flag(dev)
|
||||
ghc-options: -Wall -Werror
|
||||
else
|
||||
ghc-options: -O2 -Wall
|
||||
|
||||
default-language: Haskell2010
|
||||
|
||||
executable example
|
||||
main-is: Main.hs
|
||||
hs-source-dirs: example
|
||||
|
1
test/Spec.hs
Normal file
1
test/Spec.hs
Normal file
@ -0,0 +1 @@
|
||||
{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
|
21
test/StackTrace/PluginSpec.hs
Normal file
21
test/StackTrace/PluginSpec.hs
Normal file
@ -0,0 +1,21 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
module StackTrace.PluginSpec (spec) where
|
||||
|
||||
import Data.ByteString.Lazy (ByteString)
|
||||
import qualified Data.ByteString.Lazy as BL
|
||||
import Test.Hspec
|
||||
import System.Process.Typed
|
||||
|
||||
spec :: Spec
|
||||
spec = do
|
||||
output <- runIO exe
|
||||
expected <- runIO $ BL.readFile "test/resource/ghc86.output"
|
||||
it "integration test" $ output `shouldBe` expected
|
||||
|
||||
|
||||
exe :: IO ByteString
|
||||
exe = do
|
||||
runProcess_ $ shell "cabal install exe:example --installdir=./dist"
|
||||
err <- readProcessStderr_ $ shell "./dist/example || true"
|
||||
runProcess_ $ shell "rm -rf ./dist"
|
||||
return err
|
13
test/resource/ghc86.output
Normal file
13
test/resource/ghc86.output
Normal file
@ -0,0 +1,13 @@
|
||||
example: fError
|
||||
CallStack (from HasCallStack):
|
||||
error, called at example/Main.hs:41:10 in main:Main
|
||||
fError, called at example/Main.hs:37:11 in main:Main
|
||||
f8, called at example/Main.hs:33:16 in main:Main
|
||||
f7, called at example/Main.hs:29:11 in main:Main
|
||||
f6, called at example/Main.hs:25:15 in main:Main
|
||||
f5, called at example/Main.hs:21:8 in main:Main
|
||||
f4, called at example/Main.hs:17:6 in main:Main
|
||||
f3, called at example/Main.hs:13:6 in main:Main
|
||||
f2, called at example/Main.hs:10:6 in main:Main
|
||||
f1, called at example/Main.hs:7:14 in main:Main
|
||||
main, called at example/Main.hs:7:1 in main:Main
|
Loading…
Reference in New Issue
Block a user