hpack 0.21.1 → 0.21.2
raw patch · 6 files changed
+206/−85 lines, 6 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Hpack.Config: [packageExtraDocFiles] :: Package -> [FilePath]
+ Hpack.Config: [sectionPkgConfigDependencies] :: Section a -> [String]
- Hpack.Config: Package :: String -> String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> [String] -> [String] -> [String] -> BuildType -> Maybe String -> [FilePath] -> Maybe String -> [Flag] -> [FilePath] -> [FilePath] -> Maybe SourceRepository -> Maybe CustomSetup -> Maybe (Section Library) -> Map String (Section Library) -> Map String (Section Executable) -> Map String (Section Executable) -> Map String (Section Executable) -> Package
+ Hpack.Config: Package :: String -> String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> [String] -> [String] -> [String] -> BuildType -> Maybe String -> [FilePath] -> Maybe String -> [Flag] -> [FilePath] -> [FilePath] -> [FilePath] -> Maybe SourceRepository -> Maybe CustomSetup -> Maybe (Section Library) -> Map String (Section Library) -> Map String (Section Executable) -> Map String (Section Executable) -> Map String (Section Executable) -> Package
- Hpack.Config: Section :: a -> [FilePath] -> Dependencies -> [String] -> [String] -> [GhcOption] -> [GhcProfOption] -> [GhcjsOption] -> [CppOption] -> [CcOption] -> [FilePath] -> [FilePath] -> [FilePath] -> [FilePath] -> [FilePath] -> [FilePath] -> [FilePath] -> [FilePath] -> [LdOption] -> Maybe Bool -> [Conditional (Section a)] -> Dependencies -> Section a
+ Hpack.Config: Section :: a -> [FilePath] -> Dependencies -> [String] -> [String] -> [String] -> [GhcOption] -> [GhcProfOption] -> [GhcjsOption] -> [CppOption] -> [CcOption] -> [FilePath] -> [FilePath] -> [FilePath] -> [FilePath] -> [FilePath] -> [FilePath] -> [FilePath] -> [FilePath] -> [LdOption] -> Maybe Bool -> [Conditional (Section a)] -> Dependencies -> Section a
Files
- CHANGELOG.md +5/−0
- hpack.cabal +2/−2
- src/Hpack/Config.hs +73/−47
- src/Hpack/Run.hs +5/−0
- test/EndToEndSpec.hs +105/−21
- test/Hpack/ConfigSpec.hs +16/−15
CHANGELOG.md view
@@ -1,3 +1,8 @@+## Changes in 0.21.2+ - Fix a bug in module inference for conditionals (see #236)+ - Add support for `extra-doc-files`.+ - Add support for `pkg-config-dependencies`+ ## Changes in 0.21.1 - Allow dependency constraints to be numbers (see #234)
hpack.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: e632b2c7492b7b1a42a6c95bdf1b94a5a800b10cc81d785ee085456a5ef719c1+-- hash: 717efcb68d31a77fdd5eec9b427eaba95d5ca99c5d2aedf570e483461daa01ca name: hpack-version: 0.21.1+version: 0.21.2 synopsis: An alternative format for Haskell packages description: See README at <https://github.com/sol/hpack#readme> category: Development
src/Hpack/Config.hs view
@@ -39,6 +39,7 @@ , renameDependencies , Empty(..) , getModules+, pathsModuleFromPackageName , determineModules , BuildType(..) @@ -96,6 +97,7 @@ , packageTestedWith = Nothing , packageFlags = [] , packageExtraSourceFiles = []+ , packageExtraDocFiles = [] , packageDataFiles = [] , packageSourceRepository = Nothing , packageCustomSetup = Nothing@@ -134,7 +136,7 @@ deps xs = [(name, version) | (name, version) <- (Map.toList . unDependencies . sectionDependencies) xs] section :: a -> Section a-section a = Section a [] mempty [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Nothing [] mempty+section a = Section a [] mempty [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Nothing [] mempty packageConfig :: FilePath packageConfig = "package.yaml"@@ -189,6 +191,7 @@ data CommonOptions a capture cSources jsSources = CommonOptions { commonOptionsSourceDirs :: Maybe (List FilePath) , commonOptionsDependencies :: Maybe Dependencies+, commonOptionsPkgConfigDependencies :: Maybe (List String) , commonOptionsDefaultExtensions :: Maybe (List String) , commonOptionsOtherExtensions :: Maybe (List String) , commonOptionsGhcOptions :: Maybe (List GhcOption)@@ -366,6 +369,7 @@ , packageConfigTestedWith :: Maybe String , packageConfigFlags :: Maybe (Map String (capture FlagSection)) , packageConfigExtraSourceFiles :: Maybe (List FilePath)+, packageConfigExtraDocFiles :: Maybe (List FilePath) , packageConfigDataFiles :: Maybe (List FilePath) , packageConfigGithub :: Maybe Text , packageConfigGit :: Maybe String@@ -456,6 +460,7 @@ , packageTestedWith :: Maybe String , packageFlags :: [Flag] , packageExtraSourceFiles :: [FilePath]+, packageExtraDocFiles :: [FilePath] , packageDataFiles :: [FilePath] , packageSourceRepository :: Maybe SourceRepository , packageCustomSetup :: Maybe CustomSetup@@ -486,6 +491,7 @@ sectionData :: a , sectionSourceDirs :: [FilePath] , sectionDependencies :: Dependencies+, sectionPkgConfigDependencies :: [String] , sectionDefaultExtensions :: [String] , sectionOtherExtensions :: [String] , sectionGhcOptions :: [GhcOption]@@ -590,6 +596,9 @@ (extraSourceFilesWarnings, extraSourceFiles) <- expandGlobs "extra-source-files" dir (fromMaybeList packageConfigExtraSourceFiles) + (extraDocFilesWarnings, extraDocFiles) <-+ expandGlobs "extra-doc-files" dir (fromMaybeList packageConfigExtraDocFiles)+ (dataFilesWarnings, dataFiles) <- expandGlobs "data-files" dir (fromMaybeList packageConfigDataFiles) @@ -619,6 +628,7 @@ , packageTestedWith = packageConfigTestedWith , packageFlags = flags , packageExtraSourceFiles = extraSourceFiles+ , packageExtraDocFiles = extraDocFiles , packageDataFiles = dataFiles , packageSourceRepository = sourceRepository , packageCustomSetup = mCustomSetup@@ -635,6 +645,7 @@ ++ formatMissingSourceDirs missingSourceDirs ++ executableWarning ++ extraSourceFilesWarnings+ ++ extraDocFilesWarnings ++ dataFilesWarnings return (warnings, pkg)@@ -765,40 +776,72 @@ toCustomSetup CustomSetupSection{..} = CustomSetup { customSetupDependencies = fromMaybe mempty customSetupSectionDependencies } -traverseSectionAndConditionals :: Applicative m => (Section a -> m b) -> (Section a -> m b) -> Section a -> m (Section b)-traverseSectionAndConditionals fData fConditionals sect@Section{..} =- update <$> fData sect <*> traverseConditionals sectionConditionals+traverseSectionAndConditionals :: Monad m+ => (acc -> Section a -> m (acc, b))+ -> (acc -> Section a -> m (acc, b))+ -> acc+ -> Section a+ -> m (Section b)+traverseSectionAndConditionals fData fConditionals acc0 sect@Section{..} = do+ (acc1, x) <- fData acc0 sect+ xs <- traverseConditionals acc1 sectionConditionals+ return sect{sectionData = x, sectionConditionals = xs} where- update x xs = sect{sectionData = x, sectionConditionals = xs}- traverseConditionals = traverse $ traverse $ traverseSectionAndConditionals fConditionals fConditionals+ traverseConditionals = traverse . traverse . traverseSectionAndConditionals fConditionals fConditionals -getMentionedLibraryModules :: Section LibrarySection -> [String]-getMentionedLibraryModules = concatMap $ \ LibrarySection{..} ->+getMentionedLibraryModules :: LibrarySection -> [String]+getMentionedLibraryModules LibrarySection{..} = fromMaybeList librarySectionExposedModules ++ fromMaybeList librarySectionOtherModules +listModules :: FilePath -> Section a -> IO [String]+listModules dir Section{..} = concat <$> mapM (getModules dir) sectionSourceDirs++inferModules ::+ FilePath+ -> String+ -> (a -> [String])+ -> (b -> [String])+ -> ([String] -> [String] -> a -> b)+ -> ([String] -> a -> b)+ -> Section a+ -> IO (Section b)+inferModules dir packageName_ getMentionedModules getInferredModules fromData fromConditionals = traverseSectionAndConditionals+ (fromConfigSection fromData [pathsModuleFromPackageName packageName_])+ (fromConfigSection (\ [] -> fromConditionals) [])+ []+ where+ fromConfigSection fromConfig pathsModule_ outerModules sect@Section{sectionData = conf} = do+ modules <- listModules dir sect+ let+ mentionedModules = concatMap getMentionedModules sect+ inferableModules = (modules \\ outerModules) \\ mentionedModules+ pathsModule = (pathsModule_ \\ outerModules) \\ mentionedModules+ r = fromConfig pathsModule inferableModules conf+ return (outerModules ++ getInferredModules r, r)+ toLibrary :: FilePath -> String -> Section global -> Section LibrarySection -> IO (Section Library) toLibrary dir name globalOptions =- traverseSectionAndConditionals (fromLibrarySection True) (fromLibrarySection False)+ inferModules dir name getMentionedLibraryModules getLibraryModules fromLibrarySectionTopLevel fromLibrarySectionInConditional . mergeSections emptyLibrarySection globalOptions where- fromLibrarySection topLevel sect@Section{..} = do- modules <- concat <$> mapM (getModules dir) sectionSourceDirs- let- mentionedModules = getMentionedLibraryModules sect- inferableModules = modules \\ mentionedModules- return $ action inferableModules sectionData- where- action- | topLevel = fromLibrarySectionTopLevel- | otherwise = fromLibrarySectionInConditional+ getLibraryModules :: Library -> [String]+ getLibraryModules Library{..} = libraryExposedModules ++ libraryOtherModules - fromLibrarySectionTopLevel inferableModules LibrarySection{..} =+ fromLibrarySectionTopLevel pathsModule inferableModules LibrarySection{..} = Library librarySectionExposed exposedModules otherModules reexportedModules where (exposedModules, otherModules) =- determineModules name inferableModules librarySectionExposedModules librarySectionOtherModules+ determineModules pathsModule inferableModules librarySectionExposedModules librarySectionOtherModules reexportedModules = fromMaybeList librarySectionReexportedModules +determineModules :: [String] -> [String] -> Maybe (List String) -> Maybe (List String) -> ([String], [String])+determineModules pathsModule inferableModules mExposedModules mOtherModules = case (mExposedModules, mOtherModules) of+ (Nothing, Nothing) -> (inferableModules, pathsModule)+ _ -> (exposedModules, otherModules)+ where+ exposedModules = maybe (inferableModules \\ otherModules) fromList mExposedModules+ otherModules = maybe ((inferableModules ++ pathsModule) \\ exposedModules) fromList mOtherModules+ fromLibrarySectionInConditional :: [String] -> LibrarySection -> Library fromLibrarySectionInConditional inferableModules lib@(LibrarySection _ exposedModules otherModules _) = do case (exposedModules, otherModules) of@@ -819,31 +862,21 @@ toExecutables :: FilePath -> String -> Section global -> Map String (Section ExecutableSection) -> IO (Map String (Section Executable)) toExecutables dir packageName_ globalOptions = traverse (toExecutable dir packageName_ globalOptions) -getMentionedExecutableModules :: Section ExecutableSection -> [String]-getMentionedExecutableModules = concatMap $ \ ExecutableSection{..} ->+getMentionedExecutableModules :: ExecutableSection -> [String]+getMentionedExecutableModules ExecutableSection{..} = fromMaybeList executableSectionOtherModules ++ maybe [] return (executableSectionMain >>= toModule . splitDirectories) toExecutable :: FilePath -> String -> Section global -> Section ExecutableSection -> IO (Section Executable) toExecutable dir packageName_ globalOptions =- traverseSectionAndConditionals (fromExecutableSection True) (fromExecutableSection False)+ inferModules dir packageName_ getMentionedExecutableModules executableOtherModules fromExecutableSection (fromExecutableSection []) . expandMain . mergeSections emptyExecutableSection globalOptions where- fromExecutableSection :: Bool -> Section ExecutableSection -> IO Executable- fromExecutableSection inferPathsModule sect@Section{sectionData = ExecutableSection main_ otherModules, ..} = do- modules <- maybe inferModules (return . fromList) otherModules- return (Executable main_ modules)+ fromExecutableSection :: [String] -> [String] -> ExecutableSection -> Executable+ fromExecutableSection pathsModule inferableModules ExecutableSection{..} =+ (Executable executableSectionMain otherModules) where- mentionedModules = getMentionedExecutableModules sect-- inferModules :: IO [String]- inferModules- | null sectionSourceDirs = return []- | otherwise = (\\ mentionedModules) . (++ pathsModule) . concat <$> mapM (getModules dir) sectionSourceDirs-- pathsModule = case inferPathsModule of- True -> [pathsModuleFromPackageName packageName_]- False -> []+ otherModules = maybe (inferableModules ++ pathsModule) fromList executableSectionOtherModules expandMain :: Section ExecutableSection -> Section ExecutableSection expandMain = flatten . expand@@ -887,6 +920,7 @@ , sectionLdOptions = sectionLdOptions globalOptions ++ sectionLdOptions options , sectionBuildable = sectionBuildable options <|> sectionBuildable globalOptions , sectionDependencies = sectionDependencies options <> sectionDependencies globalOptions+ , sectionPkgConfigDependencies = sectionPkgConfigDependencies globalOptions ++ sectionPkgConfigDependencies options , sectionConditionals = map (fmap (a <$)) (sectionConditionals globalOptions) ++ sectionConditionals options , sectionBuildTools = sectionBuildTools options <> sectionBuildTools globalOptions }@@ -916,6 +950,7 @@ , sectionLdOptions = fromMaybeList commonOptionsLdOptions , sectionBuildable = commonOptionsBuildable , sectionDependencies = fromMaybe mempty commonOptionsDependencies+ , sectionPkgConfigDependencies = fromMaybeList commonOptionsPkgConfigDependencies , sectionConditionals = conditionals , sectionBuildTools = fromMaybe mempty commonOptionsBuildTools }@@ -932,15 +967,6 @@ where f '-' = '_' f x = x--determineModules :: String -> [String] -> Maybe (List String) -> Maybe (List String) -> ([String], [String])-determineModules name modules mExposedModules mOtherModules = case (mExposedModules, mOtherModules) of- (Nothing, Nothing) -> (modules, [pathsModuleFromPackageName name])- _ -> (exposedModules, otherModules)- where- otherModules = maybe ((modules \\ exposedModules) ++ pathsModule) fromList mOtherModules- exposedModules = maybe (modules \\ otherModules) fromList mExposedModules- pathsModule = [pathsModuleFromPackageName name] \\ exposedModules getModules :: FilePath -> FilePath -> IO [String] getModules dir src_ = sort <$> do
src/Hpack/Run.hs view
@@ -67,6 +67,9 @@ extraSourceFiles :: Element extraSourceFiles = Field "extra-source-files" (LineSeparatedList packageExtraSourceFiles) + extraDocFiles :: Element+ extraDocFiles = Field "extra-doc-files" (LineSeparatedList packageExtraDocFiles)+ dataFiles :: Element dataFiles = Field "data-files" (LineSeparatedList packageDataFiles) @@ -82,6 +85,7 @@ stanzas :: [Element] stanzas = extraSourceFiles+ : extraDocFiles : dataFiles : sourceRepository ++ concat [@@ -261,6 +265,7 @@ , Field "frameworks" (LineSeparatedList sectionFrameworks) , renderLdOptions sectionLdOptions , renderDependencies "build-depends" sectionDependencies+ , Field "pkgconfig-depends" (CommaSeparatedList sectionPkgConfigDependencies) , renderDependencies "build-tools" sectionBuildTools ] ++ maybe [] (return . renderBuildable) sectionBuildable
test/EndToEndSpec.hs view
@@ -20,12 +20,45 @@ spec :: Spec spec = around_ (inTempDirectoryNamed "foo") $ do describe "hpack" $ do+ describe "extra-doc-files" $ do+ it "accepts a list of files" $ do+ touch "CHANGES.markdown"+ touch "README.markdown"+ [i|+ extra-doc-files:+ - CHANGES.markdown+ - README.markdown+ |] `shouldRenderTo` package [i|+ extra-doc-files:+ CHANGES.markdown+ README.markdown+ |]++ it "accepts glob patterns" $ do+ touch "CHANGES.markdown"+ touch "README.markdown"+ [i|+ extra-doc-files:+ - "*.markdown"+ |] `shouldRenderTo` package [i|+ extra-doc-files:+ CHANGES.markdown+ README.markdown+ |]++ it "warns if a glob pattern does not match anything" $ do+ [i|+ name: foo+ extra-doc-files:+ - "*.markdown"+ |] `shouldWarn` ["Specified pattern \"*.markdown\" for extra-doc-files does not match any files"]+ describe "dependencies" $ do it "accepts single dependency" $ do [i| executable: dependencies: base- |] `shouldRenderTo` executable "foo" [i|+ |] `shouldRenderTo` executable_ "foo" [i| build-depends: base |]@@ -36,7 +69,7 @@ dependencies: - base - transformers- |] `shouldRenderTo` executable "foo" [i|+ |] `shouldRenderTo` executable_ "foo" [i| build-depends: base , transformers@@ -49,7 +82,7 @@ - base executable: dependencies: hspec- |] `shouldRenderTo` executable "foo" [i|+ |] `shouldRenderTo` executable_ "foo" [i| build-depends: base , hspec@@ -61,11 +94,24 @@ - base executable: dependencies: base >= 2- |] `shouldRenderTo` executable "foo" [i|+ |] `shouldRenderTo` executable_ "foo" [i| build-depends: base >=2 |] + describe "pkg-config-dependencies" $ do+ it "accepts pkg-config-dependencies" $ do+ [i|+ pkg-config-dependencies:+ - QtWebKit+ - weston+ executable: {}+ |] `shouldRenderTo` executable_ "foo" [i|+ pkgconfig-depends:+ QtWebKit+ , weston+ |]+ describe "include-dirs" $ do it "accepts include-dirs" $ do [i|@@ -73,7 +119,7 @@ - foo - bar executable: {}- |] `shouldRenderTo` executable "foo" [i|+ |] `shouldRenderTo` executable_ "foo" [i| include-dirs: foo bar@@ -86,7 +132,7 @@ - foo.h - bar.h executable: {}- |] `shouldRenderTo` executable "foo" [i|+ |] `shouldRenderTo` executable_ "foo" [i| install-includes: foo.h bar.h@@ -99,7 +145,7 @@ js-sources: - foo.js - jsbits/*.js- |] `shouldRenderTo` executable "foo" [i|+ |] `shouldRenderTo` executable_ "foo" [i| js-sources: foo.js jsbits/bar.js@@ -111,7 +157,7 @@ - foo.js - jsbits/*.js executable: {}- |] `shouldRenderTo` executable "foo" [i|+ |] `shouldRenderTo` executable_ "foo" [i| js-sources: foo.js jsbits/bar.js@@ -123,7 +169,7 @@ - foo - bar executable: {}- |] `shouldRenderTo` executable "foo" [i|+ |] `shouldRenderTo` executable_ "foo" [i| extra-lib-dirs: foo bar@@ -136,7 +182,7 @@ - foo - bar executable: {}- |] `shouldRenderTo` executable "foo" [i|+ |] `shouldRenderTo` executable_ "foo" [i| extra-libraries: foo bar@@ -149,7 +195,7 @@ - foo - bar executable: {}- |] `shouldRenderTo` executable "foo" [i|+ |] `shouldRenderTo` executable_ "foo" [i| extra-frameworks-dirs: foo bar@@ -162,7 +208,7 @@ - foo - bar executable: {}- |] `shouldRenderTo` executable "foo" [i|+ |] `shouldRenderTo` executable_ "foo" [i| frameworks: foo bar@@ -224,7 +270,7 @@ c-sources: cbits/*.c executables: foo: {}- |] `shouldRenderTo` executable "foo" [i|+ |] `shouldRenderTo` executable_ "foo" [i| c-sources: cbits/bar.c cbits/foo.c@@ -235,7 +281,7 @@ executables: foo: c-sources: cbits/*.c- |] `shouldRenderTo` executable "foo" [i|+ |] `shouldRenderTo` executable_ "foo" [i| c-sources: cbits/bar.c cbits/foo.c@@ -366,17 +412,18 @@ source-dirs: src when: condition: os(windows)- exposed-modules: Foo+ exposed-modules:+ - Foo+ - Paths_foo |] `shouldRenderTo` library [i| hs-source-dirs: src if os(windows) exposed-modules: Foo+ Paths_foo exposed-modules: Bar- other-modules:- Paths_foo |] context "with a source-dir inside the conditional" $ do@@ -397,6 +444,32 @@ windows |] + it "does not infer outer modules" $ do+ touch "windows/Foo.hs"+ touch "unix/Foo.hs"+ [i|+ library:+ exposed-modules: Foo+ when:+ condition: os(windows)+ then:+ source-dirs: windows/+ else:+ source-dirs: unix/++ |] `shouldRenderTo` library [i|+ exposed-modules:+ Foo+ other-modules:+ Paths_foo+ if os(windows)+ hs-source-dirs:+ windows/+ else+ hs-source-dirs:+ unix/+ |]+ context "with internal-libraries" $ do it "accepts internal-libraries" $ do touch "src/Foo.hs"@@ -537,7 +610,7 @@ when: condition: os(windows) main: Foo.hs- |] `shouldRenderTo` executable "foo" [i|+ |] `shouldRenderTo` executable_ "foo" [i| ghc-options: -Wall if os(windows) main-is: Foo.hs@@ -550,7 +623,7 @@ when: condition: os(windows) main: Foo- |] `shouldRenderTo` executable "foo" [i|+ |] `shouldRenderTo` executable_ "foo" [i| if os(windows) main-is: Foo.hs ghc-options: -main-is Foo@@ -563,7 +636,7 @@ condition: os(windows) dependencies: Win32 executable: {}- |] `shouldRenderTo` executable "foo" [i|+ |] `shouldRenderTo` executable_ "foo" [i| if os(windows) build-depends: Win32@@ -597,7 +670,7 @@ else: dependencies: unix executable: {}- |] `shouldRenderTo` executable "foo" [i|+ |] `shouldRenderTo` executable_ "foo" [i| if os(windows) build-depends: Win32@@ -700,6 +773,17 @@ where content = [i| library #{name}+#{indentBy 2 $ unindent e}+ default-language: Haskell2010+|]++executable_ :: String -> String -> Package+executable_ name e = package content+ where+ content = [i|+executable #{name}+ other-modules:+ Paths_#{name} #{indentBy 2 $ unindent e} default-language: Haskell2010 |]
test/Hpack/ConfigSpec.hs view
@@ -38,7 +38,7 @@ package = Config.package "foo" "0.0.0" executable :: String -> Executable-executable main_ = Executable (Just main_) []+executable main_ = Executable (Just main_) ["Paths_foo"] library :: Library library = Library Nothing [] ["Paths_foo"] []@@ -66,6 +66,21 @@ spec :: Spec spec = do+ describe "pathsModuleFromPackageName" $ do+ it "replaces dashes with underscores in package name" $ do+ pathsModuleFromPackageName "foo-bar" `shouldBe` "Paths_foo_bar"++ describe "determineModules" $ do+ it "adds the Paths_* module to the other-modules" $ do+ determineModules ["Paths_foo"] [] ["Foo"] Nothing `shouldBe` (["Foo"], ["Paths_foo"])++ it "adds the Paths_* module to the other-modules when no modules are specified" $ do+ determineModules ["Paths_foo"] [] Nothing Nothing `shouldBe` ([], ["Paths_foo"])++ context "when the Paths_* module is part of the exposed-modules" $ do+ it "does not add the Paths_* module to the other-modules" $ do+ determineModules ["Paths_foo"] [] ["Foo", "Paths_foo"] Nothing `shouldBe` (["Foo", "Paths_foo"], [])+ describe "fromLibrarySectionInConditional" $ do let sect = LibrarySection {@@ -139,20 +154,6 @@ touch (dir </> "Foo.hs") touch (dir </> "Setup.hs") getModules dir "./." `shouldReturn` ["Foo"]-- describe "determineModules" $ do- it "adds the Paths_* module to the other-modules" $ do- determineModules "foo" [] ["Foo"] Nothing `shouldBe` (["Foo"], ["Paths_foo"])-- it "adds the Paths_* module to the other-modules when no modules are specified" $ do- determineModules "foo" [] Nothing Nothing `shouldBe` ([], ["Paths_foo"])-- it "replaces dashes with underscores in Paths_*" $ do- determineModules "foo-bar" [] ["Foo"] Nothing `shouldBe` (["Foo"], ["Paths_foo_bar"])-- context "when the Paths_* module is part of the exposed-modules" $ do- it "does not add the Paths_* module to the other-modules" $ do- determineModules "foo" [] ["Foo", "Paths_foo"] Nothing `shouldBe` (["Foo", "Paths_foo"], []) describe "readPackageConfig" $ do it "warns on unknown fields" $ do