summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorPavan Rikhi <pavan.rikhi@gmail.com>2020-04-09 15:02:52 -0400
committerjao <jao@gnu.org>2020-04-12 01:23:38 +0100
commit9e4ee15dbab81d6d907e08f71a4622a5e3c25117 (patch)
tree90b72cb2c173b790b299acb4bc7f0abd943df160 /test
parent718a0c434e225f31ed0a347e23814989f1601f39 (diff)
downloadxmobar-9e4ee15dbab81d6d907e08f71a4622a5e3c25117.tar.gz
xmobar-9e4ee15dbab81d6d907e08f71a4622a5e3c25117.tar.bz2
Fix Tests When Compiling Without ALSA
Use CPP macros to make the ALSA Spec file a no-op when the `with_alsa` flag is set to False. Without these macros, HSpec will import the AlsaSpec module causing test compilation to fail.
Diffstat (limited to 'test')
-rw-r--r--test/Xmobar/Plugins/Monitors/AlsaSpec.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/Xmobar/Plugins/Monitors/AlsaSpec.hs b/test/Xmobar/Plugins/Monitors/AlsaSpec.hs
index 14810dd..70beda1 100644
--- a/test/Xmobar/Plugins/Monitors/AlsaSpec.hs
+++ b/test/Xmobar/Plugins/Monitors/AlsaSpec.hs
@@ -1,9 +1,12 @@
{-# OPTIONS_GHC -Wall #-}
+{-# LANGUAGE CPP #-}
+
module Xmobar.Plugins.Monitors.AlsaSpec
( main
, spec
) where
+#ifdef ALSA
import Control.Concurrent
import Control.Concurrent.Async
import Control.Monad
@@ -158,3 +161,11 @@ withFifoWriteHandle fifoPath body = do
$ \(Just h) _ _ _ -> do
hSetBuffering h LineBuffering
body h
+#else
+-- These No-Op values are required for HSpec's test discovery.
+main :: IO ()
+main = return ()
+
+spec :: Monad m => m ()
+spec = return ()
+#endif