tasty-discover 1.0.1 → 1.1.0
raw patch · 6 files changed
+28/−11 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- src/Test/Tasty/Config.hs +3/−1
- src/Test/Tasty/Type.hs +1/−0
- src/Test/Tasty/Util.hs +16/−4
- tasty-discover.cabal +1/−2
- test/ParseTest.hs +6/−3
- test/UtilTest.hs +1/−1
src/Test/Tasty/Config.hs view
@@ -12,7 +12,7 @@ -- | The empty configuration. defaultConfig :: Config-defaultConfig = Config Nothing False+defaultConfig = Config Nothing False [] -- | All configuration options. options :: [OptDescr (Config -> Config)]@@ -21,4 +21,6 @@ (ReqArg (\s c -> c {configModuleSuffix = Just s}) "SUFFIX") "" , Option [] ["no-module-suffix"] (NoArg $ \c -> c {noModuleSuffix = True}) ""+ , Option [] ["ignore-module"]+ (ReqArg (\s c -> c {ignoredModules = s : ignoredModules c}) "FILE") "" ]
src/Test/Tasty/Type.hs view
@@ -13,5 +13,6 @@ data Config = Config { configModuleSuffix :: Maybe String , noModuleSuffix :: Bool+, ignoredModules :: [FilePath] } deriving (Eq, Show)
src/Test/Tasty/Util.hs view
@@ -91,18 +91,30 @@ x:xs -> case stripSuffix (suffix ++ ".hs") x <|> stripSuffix (suffix ++ ".lhs") x of Just name | isValidModuleName name && all isValidModuleName xs ->- Just . Test (dir </> file) $- (intercalate "." . reverse) (name : xs)+ let pathComponents = reverse (name : xs)+ moduleName = intercalate "." pathComponents+ in if isIgnoredModule pathComponents+ then Nothing+ else Just . Test (dir </> file) $ moduleName _ -> Nothing _ -> Nothing + isIgnoredModule :: [FilePath] -> Bool+ isIgnoredModule pathComponents =+ let moduleName = intercalate "." pathComponents+ in moduleName `elem` ignoredModules conf+ stripSuffix :: Eq a => [a] -> [a] -> Maybe [a] stripSuffix suff str = reverse <$> stripPrefix (reverse suff) (reverse str) catchAll :: [FilePath] -> Maybe Test catchAll (x:xs) =- let name = fst $ splitExtension x in- if isValidModuleName name && all isValidModuleName xs then+ let name = fst $ splitExtension x+ pathComponents = reverse (name : xs)+ in+ if isValidModuleName name+ && all isValidModuleName xs+ && not (isIgnoredModule pathComponents) then Just . Test (dir </> file) $ (intercalate "." . reverse) (name : xs) else Nothing catchAll _ = Nothing
tasty-discover.cabal view
@@ -1,5 +1,5 @@ name: tasty-discover-version: 1.0.1+version: 1.1.0 license: GPL-3 license-file: LICENSE.md copyright: (c) 2016 Luke Murphy@@ -13,7 +13,6 @@ homepage: https://github.com/lwm/tasty-discover/ synopsis: Test discovery for the tasty framework. description: Test discovery for the tasty framework.- http://tasty-discover.readthedocs.io/en/latest/ extra-source-files: integration-test/test-configurable-module/*.hs integration-test/test-configurable-module/Nested/*.hs
test/ParseTest.hs view
@@ -9,7 +9,10 @@ case_parseConfig = parseConfig "foo" ["--module-suffix=MySuffix"] @?=- Right Config {configModuleSuffix=Just "MySuffix" , noModuleSuffix=False}+ Right Config { configModuleSuffix=Just "MySuffix"+ , noModuleSuffix=False+ , ignoredModules=[]+ } case_parseConfigMissingArg :: Assertion case_parseConfigMissingArg =@@ -21,7 +24,7 @@ case_parseConfigEmptyArg = parseConfig "foo" [] @?=- Right (Config Nothing False)+ Right (Config Nothing False []) case_parseConfigInvalidArg :: Assertion case_parseConfigInvalidArg =@@ -33,7 +36,7 @@ case_parseConfigBooleanArg = parseConfig "foo" ["--no-module-suffix"] @?=- Right Config {configModuleSuffix=Nothing, noModuleSuffix=True}+ Right Config {configModuleSuffix=Nothing, noModuleSuffix=True, ignoredModules= []} case_parseConfigInvalidArgCombination :: Assertion case_parseConfigInvalidArgCombination =
test/UtilTest.hs view
@@ -14,7 +14,7 @@ case_getListOfTestsWithSuffix :: Assertion case_getListOfTestsWithSuffix = do- let config = Config (Just "DoesntExist") False+ let config = Config (Just "DoesntExist") False [] result <- getListOfTests "test/tmpdir/" config result @?= []