diff --git a/demos/demo-custom-exceptions/app/Main.hs b/demos/demo-custom-exceptions/app/Main.hs index 7411a9ef..4286e917 100644 --- a/demos/demo-custom-exceptions/app/Main.hs +++ b/demos/demo-custom-exceptions/app/Main.hs @@ -3,14 +3,9 @@ {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ConstraintKinds #-} -{-# LANGUAGE CPP #-} module Main where -#ifdef mingw32_HOST_OS -main :: IO () -main = putStrLn "Demo not enabled on Windows." -#else import Brick import Control.Exception import Control.Monad.IO.Class @@ -60,4 +55,3 @@ testOptions = defaultOptions { main :: IO () main = runSandwich testOptions customExceptionsDemo -#endif diff --git a/demos/demo-tui/app/Main.hs b/demos/demo-tui/app/Main.hs index ee17a750..ff2e40c1 100644 --- a/demos/demo-tui/app/Main.hs +++ b/demos/demo-tui/app/Main.hs @@ -2,14 +2,9 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-} -{-# LANGUAGE CPP #-} module Main where -#ifdef mingw32_HOST_OS -main :: IO () -main = putStrLn "Demo not enabled on Windows." -#else import Common import Control.Concurrent import Control.Monad.IO.Class @@ -40,5 +35,3 @@ testOptions = defaultOptions { main :: IO () main = runSandwichWithCommandLineArgs testOptions simple - -#endif diff --git a/sandwich-slack/app/Main.hs b/sandwich-slack/app/Main.hs index 1e7e57bb..ed4ca0e1 100644 --- a/sandwich-slack/app/Main.hs +++ b/sandwich-slack/app/Main.hs @@ -10,10 +10,7 @@ import GHC.Stack import Test.Sandwich import Test.Sandwich.Formatters.Print import Test.Sandwich.Formatters.Slack - -#ifndef mingw32_HOST_OS import Test.Sandwich.Formatters.TerminalUI -#endif simple :: TopSpec @@ -42,18 +39,12 @@ slackFormatter = defaultSlackFormatter { , slackFormatterVisibilityThreshold = Just 50 } -#ifndef mingw32_HOST_OS -baseFormatter = SomeFormatter defaultTerminalUIFormatter -#else -baseFormatter = SomeFormatter defaultPrintFormatter -#endif - main :: IO () main = runSandwich options simple where options = defaultOptions { optionsTestArtifactsDirectory = TestArtifactsGeneratedDirectory "test_runs" (show <$> getCurrentTime) - , optionsFormatters = [baseFormatter, SomeFormatter slackFormatter] + , optionsFormatters = [SomeFormatter defaultTerminalUIFormatter, SomeFormatter slackFormatter] } -- * Util diff --git a/sandwich/app/Main.hs b/sandwich/app/Main.hs index ce2cf1c9..3ac38a9e 100644 --- a/sandwich/app/Main.hs +++ b/sandwich/app/Main.hs @@ -15,10 +15,7 @@ import Test.Sandwich import Test.Sandwich.Formatters.FailureReport import Test.Sandwich.Formatters.LogSaver import Test.Sandwich.Formatters.Print - -#ifndef mingw32_HOST_OS import Test.Sandwich.Formatters.TerminalUI -#endif data Database = Database String diff --git a/sandwich/src/Test/Sandwich/ArgParsing.hs b/sandwich/src/Test/Sandwich/ArgParsing.hs index 883d3478..2378eb61 100644 --- a/sandwich/src/Test/Sandwich/ArgParsing.hs +++ b/sandwich/src/Test/Sandwich/ArgParsing.hs @@ -19,17 +19,14 @@ import Test.Sandwich.Formatters.FailureReport import Test.Sandwich.Formatters.MarkdownSummary import Test.Sandwich.Formatters.Print.Types import Test.Sandwich.Formatters.Silent +import Test.Sandwich.Formatters.TerminalUI +import Test.Sandwich.Formatters.TerminalUI.Types import Test.Sandwich.Internal.Running import Test.Sandwich.Options import Test.Sandwich.Types.ArgParsing import Test.Sandwich.Types.RunTree import Test.Sandwich.Types.Spec -#ifndef mingw32_HOST_OS -import Test.Sandwich.Formatters.TerminalUI -import Test.Sandwich.Formatters.TerminalUI.Types -#endif - #if MIN_VERSION_time(1,9,0) import Data.Time.Format.ISO8601 formatTime = T.unpack . T.replace ":" "_" . T.pack . iso8601Show @@ -115,9 +112,7 @@ formatter :: Parser FormatterType formatter = flag' Print (long "print" <> help "Print to stdout") <|> flag' PrintFailures (long "print-failures" <> help "Print failures only to stdout") -#ifndef mingw32_HOST_OS <|> flag' TUI (long "tui" <> help "Open terminal UI app") -#endif <|> flag' Silent (long "silent" <> help "Run silently (print the run root only)") <|> flag Auto Auto (long "auto" <> help "Automatically decide which formatter to use") @@ -248,11 +243,9 @@ addOptionsFromArgs baseOptions (CommandLineOptions {..}) = do -- you end up with no output and a hanging process (until you hit 'q'; stdin is still attached). -- Seems like the best default is just the print formatter. printFormatter -#ifndef mingw32_HOST_OS (_, TUI) -> let mainTerminalUiFormatter = headMay [x | SomeFormatter (cast -> Just x@(TerminalUIFormatter {})) <- optionsFormatters baseOptions] in SomeFormatter $ (fromMaybe defaultTerminalUIFormatter mainTerminalUiFormatter) { terminalUILogLevel = optLogLevel } -#endif (_, Print) -> printFormatter (_, PrintFailures) -> failureReportFormatter (_, Silent) -> silentFormatter @@ -285,27 +278,18 @@ addOptionsFromArgs baseOptions (CommandLineOptions {..}) = do isMainFormatter :: SomeFormatter -> Bool isMainFormatter (SomeFormatter x) = case cast x of Just (_ :: PrintFormatter) -> True -#ifdef mingw32_HOST_OS - Nothing -> False -#else Nothing -> case cast x of Just (_ :: TerminalUIFormatter) -> True Nothing -> False -#endif setVisibilityThreshold Nothing x = x setVisibilityThreshold (Just v) x@(SomeFormatter f) = case cast f of Just pf@(PrintFormatter {}) -> SomeFormatter (pf { printFormatterVisibilityThreshold = v }) Nothing -> case cast f of -#ifdef mingw32_HOST_OS - Just (frf :: FailureReportFormatter) -> SomeFormatter (frf { failureReportVisibilityThreshold = v }) - Nothing -> x -#else Just tuif@(TerminalUIFormatter {}) -> SomeFormatter (tuif { terminalUIVisibilityThreshold = v }) Nothing -> case cast f of Just (frf :: FailureReportFormatter) -> SomeFormatter (frf { failureReportVisibilityThreshold = v }) Nothing -> x -#endif isMarkdownSummaryFormatter :: SomeFormatter -> Bool isMarkdownSummaryFormatter (SomeFormatter x) = case cast x of diff --git a/sandwich/src/Test/Sandwich/Types/ArgParsing.hs b/sandwich/src/Test/Sandwich/Types/ArgParsing.hs index 73b9b196..1012c445 100644 --- a/sandwich/src/Test/Sandwich/Types/ArgParsing.hs +++ b/sandwich/src/Test/Sandwich/Types/ArgParsing.hs @@ -11,9 +11,7 @@ import GHC.Int data FormatterType = Print -#ifndef mingw32_HOST_OS | TUI -#endif | PrintFailures | Auto | Silent @@ -21,17 +19,13 @@ data FormatterType = instance Show FormatterType where show Print = "print" show PrintFailures = "print-failures" -#ifndef mingw32_HOST_OS show TUI = "tui" -#endif show Auto = "auto" show Silent = "silent" instance Read FormatterType where readsPrec _ "print" = [(Print, "")] -#ifndef mingw32_HOST_OS readsPrec _ "tui" = [(TUI, "")] -#endif readsPrec _ "auto" = [(Auto, "")] readsPrec _ "silent" = [(Silent, "")] readsPrec _ _ = []