Skip to content

Commit

Permalink
Merge pull request #3 from codewars/hspec-formatters-codewars-0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kazk authored Feb 16, 2023
2 parents 5db0a39 + 4f0dcc1 commit 1dac3a0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion workspace/stack.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
resolver: lts-20.10

extra-deps:
- url: https://github.com/codewars/hspec-formatters-codewars/archive/v0.2.1.tar.gz
- url: https://github.com/codewars/hspec-formatters-codewars/archive/v0.3.0.tar.gz
- url: https://github.com/codewars/hspec-codewars/archive/v0.1.0.tar.gz

# Control whether we use the GHC we find on the path
Expand Down
19 changes: 14 additions & 5 deletions workspace/test/Main.hs
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
module Main where

import Test.Hspec.Runner
import Test.Hspec.Formatters.Codewars (codewars)
module Main (main) where

import qualified Spec
import System.Exit
import Test.Hspec.Core.Formatters.V2 (formatException, formatterToFormat)
import Test.Hspec.Core.Util (safeTry)
import Test.Hspec.Formatters.Codewars (escapeLF, newFormatter)
import Test.Hspec.Runner

main :: IO ()
main = hspecWith defaultConfig {configFormatter = Just codewars} Spec.spec
main = do
codewars <- newFormatter
summary <- safeTry $ runSpec Spec.spec defaultConfig {configFormat = Just $ formatterToFormat codewars}
case summary of
Left ex -> do
putStrLn $ "\n<ERROR::>Test suite crashed<:LF:>" ++ (escapeLF $ formatException ex)
exitFailure
Right s -> evaluateSummary s

0 comments on commit 1dac3a0

Please sign in to comment.