From 9e4ee15dbab81d6d907e08f71a4622a5e3c25117 Mon Sep 17 00:00:00 2001 From: Pavan Rikhi Date: Thu, 9 Apr 2020 15:02:52 -0400 Subject: 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. --- test/Xmobar/Plugins/Monitors/AlsaSpec.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test') 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 -- cgit v1.2.3