sensei 0.3.0 → 0.4.0
raw patch · 4 files changed
+85/−57 lines, 4 files
Files
- sensei.cabal +61/−55
- src/Trigger.hs +2/−2
- test/Helper.hs +13/−0
- test/TriggerSpec.hs +9/−0
sensei.cabal view
@@ -1,9 +1,11 @@--- This file has been generated from package.yaml by hpack version 0.18.0.+-- This file has been generated from package.yaml by hpack version 0.26.0. -- -- see: https://github.com/sol/hpack+--+-- hash: 1c99e15f659870947cd1d509837f537a52ef65ed0b14cf82f2ea563482748657 name: sensei-version: 0.3.0+version: 0.4.0 synopsis: Automatically run Hspec tests on file modifications category: Development homepage: https://github.com/hspec/sensei#readme@@ -26,23 +28,23 @@ driver ghc-options: -Wall build-depends:- base >= 4.7 && < 5- , base-compat >= 0.8- , process+ ansi-terminal+ , base >=4.7 && <5+ , base-compat >=0.8+ , bytestring+ , directory+ , filepath , fsnotify- , time- , wai- , warp+ , http-client >=0.5.0 , http-types+ , network+ , process , stm , text- , network- , ansi-terminal- , directory- , http-client >= 0.5.0- , bytestring- , filepath+ , time , unix+ , wai+ , warp other-modules: Client EventQueue@@ -53,6 +55,7 @@ Trigger Util Language.Haskell.GhciWrapper+ Paths_sensei default-language: Haskell2010 executable sensei@@ -63,23 +66,23 @@ driver ghc-options: -Wall build-depends:- base >= 4.7 && < 5- , base-compat >= 0.8- , process+ ansi-terminal+ , base >=4.7 && <5+ , base-compat >=0.8+ , bytestring+ , directory+ , filepath , fsnotify- , time- , wai- , warp+ , http-client >=0.5.0 , http-types+ , network+ , process , stm , text- , network- , ansi-terminal- , directory- , http-client >= 0.5.0- , bytestring- , filepath+ , time , unix+ , wai+ , warp other-modules: Client EventQueue@@ -90,6 +93,7 @@ Trigger Util Language.Haskell.GhciWrapper+ Paths_sensei default-language: Haskell2010 executable sensei-web@@ -100,23 +104,23 @@ driver ghc-options: -Wall build-depends:- base >= 4.7 && < 5- , base-compat >= 0.8- , process+ ansi-terminal+ , base >=4.7 && <5+ , base-compat >=0.8+ , bytestring+ , directory+ , filepath , fsnotify- , time- , wai- , warp+ , http-client >=0.5.0 , http-types+ , network+ , process , stm , text- , network- , ansi-terminal- , directory- , http-client >= 0.5.0- , bytestring- , filepath+ , time , unix+ , wai+ , warp other-modules: Client EventQueue@@ -127,6 +131,7 @@ Trigger Util Language.Haskell.GhciWrapper+ Paths_sensei default-language: Haskell2010 test-suite spec@@ -139,29 +144,29 @@ ghc-options: -Wall cpp-options: -DTEST build-depends:- base >= 4.7 && < 5- , base-compat >= 0.8- , process- , fsnotify- , time- , wai- , warp- , http-types- , stm- , text- , network- , ansi-terminal- , directory- , http-client >= 0.5.0+ ansi-terminal+ , base >=4.7 && <5+ , base-compat >=0.8 , bytestring+ , directory , filepath- , unix- , hspec >= 2.2.1+ , fsnotify+ , hspec >=2.2.1 , hspec-meta , hspec-wai+ , http-client >=0.5.0+ , http-types+ , interpolate , mockery+ , network+ , process , silently- , interpolate+ , stm+ , text+ , time+ , unix+ , wai+ , warp other-modules: Client EventQueue@@ -179,4 +184,5 @@ SessionSpec TriggerSpec UtilSpec+ Paths_sensei default-language: Haskell2010
src/Trigger.hs view
@@ -10,7 +10,6 @@ import Prelude () import Prelude.Compat import Data.List.Compat-import Data.Char import Session (Session, isFailure, isSuccess, hspecPreviousSummary, resetSummary) import qualified Session@@ -25,8 +24,9 @@ where success :: String -> Bool success x = case stripPrefix "Ok, " x of+ Just "one module loaded." -> True Just "1 module loaded." -> True- Just xs | " modules loaded." <- dropWhile isNumber xs -> True+ Just xs | [_number, "modules", "loaded."] <- words xs -> True Just xs -> "modules loaded: " `isPrefixOf` xs Nothing -> False
test/Helper.hs view
@@ -80,6 +80,19 @@ mods = case xs of [] -> "none" _ -> intercalate ", " xs+#elif MIN_VERSION_base(4,10,1)+modulesLoaded status xs = show status ++ ", " ++ mods ++ " loaded."+ where+ n = length xs+ mods+ | n == 0 = "no modules"+ | n == 1 = "one module"+ | n == 2 = "two modules"+ | n == 3 = "three modules"+ | n == 4 = "four modules"+ | n == 5 = "five modules"+ | n == 6 = "six modules"+ | otherwise = show n ++ " modules" #else modulesLoaded status xs = show status ++ ", " ++ show n ++ " " ++ mods ++ " loaded." where
test/TriggerSpec.hs view
@@ -55,6 +55,15 @@ it "detects success" $ do reloadedSuccessfully "Ok, 5 modules loaded." `shouldBe` True + context "with GHC >= 8.2.2" $ do+ context "with a single module" $ do+ it "detects success" $ do+ reloadedSuccessfully "Ok, one module loaded." `shouldBe` True++ context "with multiple modules" $ do+ it "detects success" $ do+ reloadedSuccessfully "Ok, four modules loaded." `shouldBe` True+ describe "triggerAll" $ around_ withSomeSpec $ do it "runs all specs" $ do withSession ["Spec.hs", "--no-color"] $ \session -> do