Skip to content

Commit

Permalink
Initialize logging for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonchinn178 committed Jan 20, 2024
1 parent 2469699 commit 2c9e39e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion ormolu.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,11 @@ executable ormolu

test-suite tests
type: exitcode-stdio-1.0
main-is: Spec.hs
main-is: Main.hs
build-tool-depends: hspec-discover:hspec-discover >=2 && <3
hs-source-dirs: tests
other-modules:
Spec
Ormolu.CabalInfoSpec
Ormolu.Diff.TextSpec
Ormolu.Fixity.ParserSpec
Expand Down
11 changes: 11 additions & 0 deletions tests/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Main where

import Ormolu.Config qualified as Ormolu
import Ormolu.Logging (initializeLogging)
import Spec qualified
import Test.Hspec.Runner

main :: IO ()
main = do
initializeLogging Ormolu.defaultConfig
hspec Spec.spec
2 changes: 1 addition & 1 deletion tests/Spec.hs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
{-# OPTIONS_GHC -F -pgmF hspec-discover -optF --module-name=Spec #-}
1 change: 1 addition & 0 deletions weeder.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
roots = [
"^Main.main$",
"^Paths_",
"^Spec.main$",
"^Ormolu.Terminal.QualifiedDo.>>$" # https://github.com/ocharles/weeder/issues/112
]
type-class-roots = true

0 comments on commit 2c9e39e

Please sign in to comment.