module HsBindgen.Test.Readme ( genTestsReadme ) where import System.FilePath qualified as FilePath import HsBindgen.Config.Prelims {------------------------------------------------------------------------------- Generation -------------------------------------------------------------------------------} genTestsReadme :: FilePath -- ^ README path -> BaseModuleName -- ^ Module name (example: @Acme.Foo@) -> FilePath -- ^ Test suite directory path -> FilePath -- ^ C header path -> FilePath -- ^ C source path -> IO () genTestsReadme readmePath baseModule testSuitePath cHeaderPath cSourcePath = writeFile readmePath $ unlines [ "# " ++ moduleNameStr ++ " hs-bindgen Test Suite" , "" , "The content under this directory is automatically generated by [hs-bindgen][]." , "" , "[hs-bindgen]: " , "" , "## Example Cabal Configuration" , "" , "Be sure to add your project to the dependencies." , "" , "```" , "test-suite " ++ testSuite , " type: exitcode-stdio-1.0" , " hs-source-dirs: " ++ testSuite ++ "/src" , " main-is: Main.hs" , " other-modules:" , " " ++ moduleNameStr ++ ".Test" , " Main" , " Spec" , " include-dirs:" , " " ++ testSuite ++ "/cbits" , " install-includes:" , " " ++ FilePath.takeFileName cHeaderPath , " c-sources:" , " " ++ testSuite ++ "/cbits/" ++ FilePath.takeFileName cSourcePath , " build-depends:" , " base" , " , hs-bindgen-test-runtime" , " , QuickCheck" , " , tasty" , " , tasty-hunit" , " , tasty-quickcheck" , " default-language: Haskell2010" , " ghc-options: -Wall" , "```" ] where testSuite :: String testSuite = FilePath.takeFileName testSuitePath moduleNameStr :: String moduleNameStr = baseModuleNameToString baseModule