Monadoro 0.3.6.2 → 0.4.0.0
raw patch · 5 files changed
+62/−10 lines, 5 filesdep −hspecPVP ok
version bump matches the API change (PVP)
Dependencies removed: hspec
API changes (from Hackage documentation)
Files
- Monadoro.cabal +3/−6
- changelog +13/−0
- src/CLI.hs +9/−1
- src/ParseTime.lhs +8/−0
- test/Main.hs +29/−3
Monadoro.cabal view
@@ -1,17 +1,17 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4.+-- This file has been generated from package.yaml by hpack version 0.35.0. -- -- see: https://github.com/sol/hpack name: Monadoro-version: 0.3.6.2+version: 0.4.0.0 synopsis: A minimalistic CLI Pomodoro timer. description: A Pomodoro timer with two modes: single-pomodoro (default), and four-pomodoro (`--session`). category: Tools author: Patryk Kocielnik maintainer: patryk@kocielnik.pl-copyright: 2018-2022 Patryk Kocielnik+copyright: 2018-2025 Patryk Kocielnik license: MIT license-file: LICENSE build-type: Simple@@ -47,7 +47,6 @@ Paths_Monadoro hs-source-dirs: app- ghc-options: -threaded -rtsopts -with-rtsopts=-N build-depends: Monadoro , base >=4.7 && <5@@ -62,12 +61,10 @@ Paths_Monadoro hs-source-dirs: test- ghc-options: -threaded -rtsopts -with-rtsopts=-N build-depends: Monadoro , base >=4.7 && <5 , doctest >=0.8- , hspec , process >=1.6 && <2 , time >=1.8 && <2 default-language: Haskell2010
changelog view
@@ -1,3 +1,16 @@+monadoro (4.0.0)++ * Add a newline in the end of timer countdown.++ Each countdown was missing a newline character when it ended.++ MacOS showed this explicitly, with a percent mark (`%`), after each+ such line. Thanks to that I found this problem.++ The test is not coupled to this behavior. I have not found a way to+ test this with DocTest, and without DocTest the test would not have+ been as clear.+ monadoro (3.6.2) * Test an internal method for printing usage.
src/CLI.hs view
@@ -58,9 +58,14 @@ runSession :: [String] -> IO () runSession xs = session (getDelayIfNeeded xs) +{-| runTimer++>>> runTimer noDelay ["00:01"]+...00:00+-} runTimer :: IO () -> [String] -> IO () runTimer delayer [] = void (countdownLoop delayer "25:00")-runTimer delayer [t] = void (countdownLoop delayer t)+runTimer delayer [t] = void (countdownLoop delayer t) >> putStrLn "" runTimer delayer (t:ts) = runTimer delayer [t] >> runTimer delayer ts filterParams :: [String] -> [String]@@ -141,6 +146,9 @@ getDelayIfNeeded xs | xs `containsEither` ["--nodelay", "-n"] = wait 0 | otherwise = wait 1++noDelay :: IO ()+noDelay = wait 0 milisecPerSecond :: Int milisecPerSecond = 10 ^ (6 :: Int)
src/ParseTime.lhs view
@@ -99,6 +99,14 @@ > > >>> count_down_time "01:00" > "00:59"+>+> What happens when an invalid period is given?+>+> >>> count_down_time "foo"+> "*** Exception: Prelude.head: empty list+>+> Turns out Vim highlighting doesn't handle this lack+> of double quotes well, but tests complete OK. > -} > > count_down_time :: String -> String
test/Main.hs view
@@ -1,10 +1,36 @@-import Test.DocTest+import GHC.Stack.Types (HasCallStack)+import Test.DocTest (doctest) -main :: IO ()-main = doctest [+assert :: HasCallStack => Bool -> String+assert False = error "Assertion failed!"+assert _ = ""++checkCondition :: HasCallStack => IO ()+checkCondition+ | result == "" = putStr ""+ | otherwise = putStrLn result+ where result = assert (0 /= 1)++runOtherTests :: HasCallStack => IO ()+runOtherTests = checkCondition++runDocTests :: IO ()+runDocTests = doctest [ "-isrc", "src/CLI.hs", "src/ParseTime.lhs", "src/CountdownLoop.hs", "src/Pomodoro.lhs" ]++main :: IO ()+main = runDocTests >> runOtherTests++-- These tests take 5 seconds to execute even when+-- *nothing* was changed!+--+-- If something *was* changed, they take between *18+-- and 26* seconds.+--+-- Pytest wouldn't take a *single second* to test all+-- this! Can we get closer to that result?