packages feed

sydtest 0.13.0.3 → 0.13.0.4

raw patch · 6 files changed

+39/−27 lines, 6 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Test.Syd.OptParse: [flagFilter] :: Flags -> !Maybe Text
- Test.Syd.OptParse: [settingFilter] :: Settings -> !Maybe Text
+ Test.Syd.OptParse: [flagFilters] :: Flags -> ![Text]
+ Test.Syd.OptParse: [settingFilters] :: Settings -> ![Text]
+ Test.Syd.OptParse: manyOptional :: Mod OptionFields [Text] -> Parser [Text]
- Test.Syd.OptParse: Flags :: !Maybe FilePath -> !Maybe SeedSetting -> !Maybe Bool -> !Maybe Threads -> !Maybe Int -> !Maybe Int -> !Maybe Int -> !Maybe Int -> !Maybe Bool -> !Maybe Bool -> !Maybe Bool -> !Maybe Text -> !Maybe Bool -> !Maybe Iterations -> !Maybe Word -> !Maybe Bool -> !Maybe Bool -> !Maybe Bool -> Flags
+ Test.Syd.OptParse: Flags :: !Maybe FilePath -> !Maybe SeedSetting -> !Maybe Bool -> !Maybe Threads -> !Maybe Int -> !Maybe Int -> !Maybe Int -> !Maybe Int -> !Maybe Bool -> !Maybe Bool -> !Maybe Bool -> ![Text] -> !Maybe Bool -> !Maybe Iterations -> !Maybe Word -> !Maybe Bool -> !Maybe Bool -> !Maybe Bool -> Flags
- Test.Syd.OptParse: Settings :: !SeedSetting -> !Bool -> !Threads -> !Int -> !Int -> !Int -> !Int -> !Bool -> !Bool -> !Maybe Bool -> !Maybe Text -> !Bool -> !Iterations -> !Word -> !Bool -> !ReportProgress -> !Bool -> Settings
+ Test.Syd.OptParse: Settings :: !SeedSetting -> !Bool -> !Threads -> !Int -> !Int -> !Int -> !Int -> !Bool -> !Bool -> !Maybe Bool -> ![Text] -> !Bool -> !Iterations -> !Word -> !Bool -> !ReportProgress -> !Bool -> Settings
- Test.Syd.SpecDef: filterTestForest :: Maybe Text -> SpecDefForest outers inner result -> SpecDefForest outers inner result
+ Test.Syd.SpecDef: filterTestForest :: [Text] -> SpecDefForest outers inner result -> SpecDefForest outers inner result

Files

CHANGELOG.md view
@@ -1,5 +1,12 @@ # Changelog +## [0.13.0.4] - 2023-03-31++### Added++* Allow supplying multiple `--filter`/`--match` flags.+* Add short names `-m` and `-f` for the filter flag options.+ ## [0.13.0.3] - 2023-03-27  ### Added
src/Test/Syd/Def/TestDefM.hs view
@@ -74,7 +74,7 @@             testDefEnvTestRunSettings = toTestRunSettings sets           }   (a, testForest) <- runReaderT (runWriterT func) testDefEnv-  let testForest' = filterTestForest (settingFilter sets) testForest+  let testForest' = filterTestForest (settingFilters sets) testForest   stdgen <- case settingSeed sets of     FixedSeed seed -> pure $ mkStdGen seed     RandomSeed -> newStdGen
src/Test/Syd/OptParse.hs view
@@ -11,6 +11,7 @@ import Autodocodec.Yaml import Control.Applicative import Control.Monad+import Data.Functor ((<&>)) import Data.Maybe import Data.Text (Text) import qualified Data.Text as T@@ -60,8 +61,8 @@     settingGoldenReset :: !Bool,     -- | Whether to use colour in the output     settingColour :: !(Maybe Bool),-    -- | The filter to use to select which tests to run-    settingFilter :: !(Maybe Text),+    -- | The filters to use to select which tests to run+    settingFilters :: ![Text],     -- | Whether to stop upon the first test failure     settingFailFast :: !Bool,     -- | How many iterations to use to look diagnose flakiness@@ -91,7 +92,7 @@           settingGoldenStart = d testRunSettingGoldenStart,           settingGoldenReset = d testRunSettingGoldenReset,           settingColour = Nothing,-          settingFilter = Nothing,+          settingFilters = mempty,           settingFailFast = False,           settingIterations = OneIteration,           settingRetries = defaultRetries,@@ -186,7 +187,7 @@         settingGoldenStart = fromMaybe (d settingGoldenStart) $ flagGoldenStart <|> envGoldenStart <|> mc configGoldenStart,         settingGoldenReset = fromMaybe (d settingGoldenReset) $ flagGoldenReset <|> envGoldenReset <|> mc configGoldenReset,         settingColour = flagColour <|> envColour <|> mc configColour,-        settingFilter = flagFilter <|> envFilter <|> mc configFilter,+        settingFilters = flagFilters <|> maybeToList envFilter <|> maybeToList (mc configFilter),         settingFailFast =           fromMaybe             (if debugMode then True else d settingFailFast)@@ -437,7 +438,7 @@     flagGoldenStart :: !(Maybe Bool),     flagGoldenReset :: !(Maybe Bool),     flagColour :: !(Maybe Bool),-    flagFilter :: !(Maybe Text),+    flagFilters :: ![Text],     flagFailFast :: !(Maybe Bool),     flagIterations :: !(Maybe Iterations),     flagRetries :: !(Maybe Word),@@ -461,7 +462,7 @@       flagGoldenStart = Nothing,       flagGoldenReset = Nothing,       flagColour = Nothing,-      flagFilter = Nothing,+      flagFilters = mempty,       flagFailFast = Nothing,       flagIterations = Nothing,       flagRetries = Nothing,@@ -555,24 +556,25 @@     <*> doubleSwitch ["golden-start"] (help "Whether to write golden tests if they do not exist yet")     <*> doubleSwitch ["golden-reset"] (help "Whether to overwrite golden tests instead of having them fail")     <*> doubleSwitch ["colour", "color"] (help "Use colour in output")-    <*> ( optional-            ( strArgument-                ( mconcat-                    [ help "Filter to select which parts of the test tree to run",-                      metavar "FILTER"-                    ]-                )-            )-            <|> optional-              ( strOption+    <*> ( maybeToList+            <$> optional+              ( strArgument                   ( mconcat-                      [ long "filter",-                        long "match",-                        help "Filter to select which parts of the test tree to run",+                      [ help "Filter to select which parts of the test tree to run",                         metavar "FILTER"                       ]                   )               )+            <|> manyOptional+              ( mconcat+                  [ short 'f',+                    long "filter",+                    short 'm',+                    long "match",+                    help "Filter to select which parts of the test tree to run",+                    metavar "FILTER"+                  ]+              )         )     <*> doubleSwitch ["fail-fast"] (help "Stop upon the first test failure")     <*> optional@@ -611,6 +613,9 @@     <*> doubleSwitch ["fail-on-flaky"] (help "Fail when any flakiness is detected")     <*> doubleSwitch ["progress"] (help "Report progress")     <*> doubleSwitch ["debug"] (help "Turn on debug mode. This implies --no-randomise-execution-order, --synchronous, --progress and --fail-fast.")++manyOptional :: OptParse.Mod OptionFields [Text] -> OptParse.Parser [Text]+manyOptional modifier = mconcat <$> many (option (str <&> T.words) modifier)  seedSettingFlags :: OptParse.Parser (Maybe SeedSetting) seedSettingFlags =
src/Test/Syd/SpecDef.hs view
@@ -193,8 +193,8 @@           DefFlakinessNode p sdf -> DefFlakinessNode p <$> goF sdf           DefExpectationNode p sdf -> DefExpectationNode p <$> goF sdf -filterTestForest :: Maybe Text -> SpecDefForest outers inner result -> SpecDefForest outers inner result-filterTestForest mf = fromMaybe [] . goForest DList.empty+filterTestForest :: [Text] -> SpecDefForest outers inner result -> SpecDefForest outers inner result+filterTestForest fs = fromMaybe [] . goForest DList.empty   where     goForest :: DList Text -> SpecDefForest a b c -> Maybe (SpecDefForest a b c)     goForest ts sdf = do@@ -203,9 +203,9 @@       pure sdf'      filterGuard :: DList Text -> Bool-    filterGuard dl = case mf of-      Just f -> f `T.isInfixOf` T.intercalate "." (DList.toList dl)-      Nothing -> True+    filterGuard dl =+      null fs+        || any (\f -> f `T.isInfixOf` T.intercalate "." (DList.toList dl)) fs      goTree :: DList Text -> SpecDefTree a b c -> Maybe (SpecDefTree a b c)     goTree dl = \case
sydtest.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           sydtest-version:        0.13.0.3+version:        0.13.0.4 synopsis:       A modern testing framework for Haskell with good defaults and advanced testing features. description:    A modern testing framework for Haskell with good defaults and advanced testing features. Sydtest aims to make the common easy and the hard possible. See https://github.com/NorfairKing/sydtest#readme for more information. category:       Testing
test_resources/defaultSettings-show.golden view
@@ -9,7 +9,7 @@   , settingGoldenStart = False   , settingGoldenReset = False   , settingColour = Nothing-  , settingFilter = Nothing+  , settingFilters = []   , settingFailFast = False   , settingIterations = OneIteration   , settingRetries = 3