From a071c2a49d0804e410cdc3aeb9c49b622c9a416a Mon Sep 17 00:00:00 2001 From: Tomas Janousek Date: Wed, 18 Nov 2020 20:27:52 +0000 Subject: test: Fix flaky CpuSpec Failed at least once in GitHub Actions: predicate failed on: "Cpu: 100% ##########" Also, there's no need to guard the Xmobar.Plugins.Monitors.CpuSpec module with the with_alsa flag. (And it doesn't really work anyway, hspec-discover doesn't care about what modules are declared in cabal, so stack/ghc complains that "These modules are needed for compilation but not listed in your .cabal file's other-modules: Xmobar.Plugins.Monitors.AlsaSpec" and then fails to detect changes in those modules.) --- test/Xmobar/Plugins/Monitors/CpuSpec.hs | 2 +- xmobar.cabal | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Xmobar/Plugins/Monitors/CpuSpec.hs b/test/Xmobar/Plugins/Monitors/CpuSpec.hs index 449acd5..3d07dee 100644 --- a/test/Xmobar/Plugins/Monitors/CpuSpec.hs +++ b/test/Xmobar/Plugins/Monitors/CpuSpec.hs @@ -23,7 +23,7 @@ spec = do let args = ["-L","3","-H","50","--normal","green","--high","red", "-t", "Cpu: % "] cpuArgs <- getArguments args cpuValue <- runCpu cpuArgs - cpuValue `shouldSatisfy` (\item -> "::" `isSuffixOf` item) + cpuValue `shouldSatisfy` (all (`elem` ":#") . last . words) it "works with no icon pattern template" $ do let args = ["-L","3","-H","50","--normal","green","--high","red", "-t", "Cpu: % ", "--", "--load-icon-pattern", ""] cpuArgs <- getArguments args diff --git a/xmobar.cabal b/xmobar.cabal index c03db46..1a9b41b 100644 --- a/xmobar.cabal +++ b/xmobar.cabal @@ -335,6 +335,7 @@ test-suite XmobarTest Xmobar.Plugins.Monitors.Common.Output Xmobar.Plugins.Monitors.Common.Files Xmobar.Plugins.Monitors.Cpu + Xmobar.Plugins.Monitors.CpuSpec Xmobar.Plugins.Monitors.Common.Run Xmobar.Run.Exec Xmobar.App.Timer @@ -347,7 +348,6 @@ test-suite XmobarTest other-modules: Xmobar.Plugins.Monitors.Volume Xmobar.Plugins.Monitors.Alsa Xmobar.Plugins.Monitors.AlsaSpec - Xmobar.Plugins.Monitors.CpuSpec cpp-options: -DALSA -- cgit v1.2.3