cabal-gild 1.4.0.0 → 1.4.0.1
raw patch · 3 files changed
+97/−91 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- cabal-gild.cabal +1/−1
- source/library/CabalGild/Unstable/Action/EvaluatePragmas.hs +5/−9
- source/test-suite/Main.hs +91/−81
cabal-gild.cabal view
@@ -11,7 +11,7 @@ maintainer: Taylor Fausak name: cabal-gild synopsis: Formats package descriptions.-version: 1.4.0.0+version: 1.4.0.1 source-repository head type: git
source/library/CabalGild/Unstable/Action/EvaluatePragmas.hs view
@@ -76,21 +76,17 @@ let (excs, incs) = Either.partitionEithers flgs mapM_ (Exception.throwM . UnknownOption.fromString) opts mapM_ (Exception.throwM . InvalidOption.fromString) errs- let root = FilePath.takeDirectory p+ let root = FilePath.dropTrailingPathSeparator . normalize $ FilePath.takeDirectory p directories = List.nubOrd- . fmap- ( FilePath.dropTrailingPathSeparator- . normalize- . FilePath.combine root- )+ . fmap normalize $ if null args then ["."] else args- let exclusions = List.nubOrd $ fmap (normalize . FilePath.combine root) excs+ exclusions = List.nubOrd $ fmap normalize excs inclusions = List.nubOrd- . fmap (normalize . FilePath.combine root)+ . fmap normalize $ if null incs then ["**"] else incs- files <- Trans.lift $ MonadWalk.walk "." inclusions exclusions+ files <- Trans.lift $ MonadWalk.walk root inclusions exclusions let comments = concatMap (snd . FieldLine.annotation) fls position = maybe (fst $ Name.annotation n) (fst . FieldLine.annotation) $
source/test-suite/Main.hs view
@@ -35,31 +35,31 @@ main :: IO () main = Hspec.hspec . Hspec.parallel . Hspec.describe "cabal-gild" $ do Hspec.it "shows the help" $ do- let (a, s, w) = runGild ["--help"] [] []+ let (a, s, w) = runGild ["--help"] [] (".", []) a `shouldBeFailure` Exit.ExitSuccess w `Hspec.shouldNotBe` [] s `Hspec.shouldBe` Map.empty Hspec.it "shows the version" $ do- let (a, s, w) = runGild ["--version"] [] []+ let (a, s, w) = runGild ["--version"] [] (".", []) a `shouldBeFailure` Exit.ExitSuccess w `Hspec.shouldNotBe` [] s `Hspec.shouldBe` Map.empty Hspec.it "fails with an unknown option" $ do- let (a, s, w) = runGild ["--unknown"] [] []+ let (a, s, w) = runGild ["--unknown"] [] (".", []) a `shouldBeFailure` UnknownOption.UnknownOption "--unknown" w `Hspec.shouldBe` [] s `Hspec.shouldBe` Map.empty Hspec.it "fails with an invalid option" $ do- let (a, s, w) = runGild ["--help=invalid"] [] []+ let (a, s, w) = runGild ["--help=invalid"] [] (".", []) a `shouldBeFailure` InvalidOption.InvalidOption "option `--help' doesn't allow an argument" w `Hspec.shouldBe` [] s `Hspec.shouldBe` Map.empty Hspec.it "fails with an unexpected argument" $ do- let (a, s, w) = runGild ["unexpected"] [] []+ let (a, s, w) = runGild ["unexpected"] [] (".", []) a `shouldBeFailure` UnexpectedArgument.UnexpectedArgument "unexpected" w `Hspec.shouldBe` [] s `Hspec.shouldBe` Map.empty@@ -69,7 +69,7 @@ runGild ["--input", "input.cabal"] [(Input.File "input.cabal", String.toUtf8 "")]- []+ (".", []) a `Hspec.shouldSatisfy` Either.isRight w `Hspec.shouldBe` [] s `Hspec.shouldBe` Map.singleton Output.Stdout (String.toUtf8 "")@@ -79,7 +79,7 @@ runGild ["--output", "output.cabal"] [(Input.Stdin, String.toUtf8 "")]- []+ (".", []) a `Hspec.shouldSatisfy` Either.isRight w `Hspec.shouldBe` [] s `Hspec.shouldBe` Map.singleton (Output.File "output.cabal") (String.toUtf8 "")@@ -89,7 +89,7 @@ runGild ["--mode", "check"] [(Input.Stdin, String.toUtf8 "pass: yes\n")]- []+ (".", []) a `Hspec.shouldSatisfy` Either.isRight w `Hspec.shouldBe` [] s `Hspec.shouldBe` Map.empty@@ -99,7 +99,7 @@ runGild ["--mode", "check"] [(Input.Stdin, String.toUtf8 "pass: no")]- []+ (".", []) a `shouldBeFailure` CheckFailure.CheckFailure w `Hspec.shouldBe` [] s `Hspec.shouldBe` Map.empty@@ -109,7 +109,7 @@ runGild ["--mode", "check"] [(Input.Stdin, String.toUtf8 "pass: yes\r\n")]- []+ (".", []) a `Hspec.shouldSatisfy` Either.isRight w `Hspec.shouldBe` [] s `Hspec.shouldBe` Map.empty@@ -119,7 +119,7 @@ runGild ["--crlf", "strict", "--mode", "check"] [(Input.Stdin, String.toUtf8 "pass: no\r\n")]- []+ (".", []) a `shouldBeFailure` CheckFailure.CheckFailure w `Hspec.shouldBe` [] s `Hspec.shouldBe` Map.empty@@ -129,7 +129,7 @@ runGild ["--input", "f", "--stdin", "g"] []- []+ (".", []) a `shouldBeFailure` SpecifiedStdinWithFileInput.SpecifiedStdinWithFileInput w `Hspec.shouldBe` [] s `Hspec.shouldBe` Map.empty@@ -139,7 +139,7 @@ runGild ["--mode", "check", "--output", "-"] []- []+ (".", []) a `shouldBeFailure` SpecifiedOutputWithCheckMode.SpecifiedOutputWithCheckMode w `Hspec.shouldBe` [] s `Hspec.shouldBe` Map.empty@@ -149,7 +149,7 @@ runGild ["--io", "io.cabal"] [(Input.File "io.cabal", String.toUtf8 "")]- []+ (".", []) a `Hspec.shouldSatisfy` Either.isRight w `Hspec.shouldBe` [] s `Hspec.shouldBe` Map.empty@@ -159,7 +159,7 @@ runGild ["--input", "p.cabal"] [(Input.File "p.cabal", String.toUtf8 "")]- []+ (".", []) a `Hspec.shouldSatisfy` Either.isRight w `Hspec.shouldBe` [] s `Hspec.shouldBe` Map.singleton Output.Stdout (String.toUtf8 "")@@ -169,7 +169,7 @@ runGild ["--input", "p.cabal", "--output", "q.cabal"] [(Input.File "p.cabal", String.toUtf8 "")]- []+ (".", []) a `Hspec.shouldSatisfy` Either.isRight w `Hspec.shouldBe` [] s `Hspec.shouldBe` Map.singleton (Output.File "q.cabal") (String.toUtf8 "")@@ -179,7 +179,7 @@ runGild ["--output", "q.cabal"] [(Input.Stdin, String.toUtf8 "")]- []+ (".", []) a `Hspec.shouldSatisfy` Either.isRight w `Hspec.shouldBe` [] s `Hspec.shouldBe` Map.singleton (Output.File "q.cabal") (String.toUtf8 "")@@ -189,7 +189,7 @@ runGild ["--io", "io.cabal"] [(Input.File "io.cabal", String.toUtf8 "f:a")]- []+ (".", []) a `Hspec.shouldSatisfy` Either.isRight w `Hspec.shouldBe` [] s `Hspec.shouldBe` Map.singleton (Output.File "io.cabal") (String.toUtf8 "f: a\n")@@ -199,7 +199,7 @@ runGild ["--io", "p.cabal"] [(Input.File "p.cabal", String.toUtf8 "s\r\n")]- []+ (".", []) a `Hspec.shouldSatisfy` Either.isRight w `Hspec.shouldBe` [] s `Hspec.shouldBe` Map.empty@@ -209,7 +209,7 @@ runGild ["--crlf", "strict", "--io", "p.cabal"] [(Input.File "p.cabal", String.toUtf8 "s\r\n")]- []+ (".", []) a `Hspec.shouldSatisfy` Either.isRight w `Hspec.shouldBe` [] s `Hspec.shouldBe` Map.singleton (Output.File "p.cabal") (String.toUtf8 "s\n")@@ -219,7 +219,7 @@ runGild ["--stdin", "d/p.cabal"] [(Input.Stdin, String.toUtf8 "library\n -- cabal-gild: discover\n exposed-modules:")]- [["d", "M.hs"]]+ ("d", [["M.hs"]]) a `Hspec.shouldSatisfy` Either.isRight w `Hspec.shouldBe` [] s `Hspec.shouldBe` Map.singleton Output.Stdout (String.toUtf8 "library\n -- cabal-gild: discover\n exposed-modules: M\n")@@ -1071,25 +1071,25 @@ Hspec.it "discovers an exposed module" $ do expectDiscover- [["M.hs"]]+ (".", [["M.hs"]]) "library\n -- cabal-gild: discover\n exposed-modules:" "library\n -- cabal-gild: discover\n exposed-modules: M\n" Hspec.it "discovers an other module" $ do expectDiscover- [["M.hs"]]+ (".", [["M.hs"]]) "library\n -- cabal-gild: discover\n other-modules:" "library\n -- cabal-gild: discover\n other-modules: M\n" Hspec.it "discovers a nested module" $ do expectDiscover- [["N", "O.hs"]]+ (".", [["N", "O.hs"]]) "library\n -- cabal-gild: discover\n exposed-modules:" "library\n -- cabal-gild: discover\n exposed-modules: N.O\n" Hspec.it "discovers multiple modules" $ do expectDiscover- [["M.hs"], ["N.hs"]]+ (".", [["M.hs"], ["N.hs"]]) "library\n -- cabal-gild: discover\n exposed-modules:" "library\n -- cabal-gild: discover\n exposed-modules:\n M\n N\n" @@ -1100,67 +1100,67 @@ Hspec.it "discovers a .lhs file" $ do expectDiscover- [["M.lhs"]]+ (".", [["M.lhs"]]) "library\n -- cabal-gild: discover\n exposed-modules:" "library\n -- cabal-gild: discover\n exposed-modules: M\n" Hspec.it "discovers a .gc file" $ do expectDiscover- [["M.gc"]]+ (".", [["M.gc"]]) "library\n -- cabal-gild: discover\n exposed-modules:" "library\n -- cabal-gild: discover\n exposed-modules: M\n" Hspec.it "discovers a .chs file" $ do expectDiscover- [["M.chs"]]+ (".", [["M.chs"]]) "library\n -- cabal-gild: discover\n exposed-modules:" "library\n -- cabal-gild: discover\n exposed-modules: M\n" Hspec.it "discovers a .hsc file" $ do expectDiscover- [["M.hsc"]]+ (".", [["M.hsc"]]) "library\n -- cabal-gild: discover\n exposed-modules:" "library\n -- cabal-gild: discover\n exposed-modules: M\n" Hspec.it "discovers a .y file" $ do expectDiscover- [["M.y"]]+ (".", [["M.y"]]) "library\n -- cabal-gild: discover\n exposed-modules:" "library\n -- cabal-gild: discover\n exposed-modules: M\n" Hspec.it "discovers a .ly file" $ do expectDiscover- [["M.ly"]]+ (".", [["M.ly"]]) "library\n -- cabal-gild: discover\n exposed-modules:" "library\n -- cabal-gild: discover\n exposed-modules: M\n" Hspec.it "discovers a .x file" $ do expectDiscover- [["M.x"]]+ (".", [["M.x"]]) "library\n -- cabal-gild: discover\n exposed-modules:" "library\n -- cabal-gild: discover\n exposed-modules: M\n" Hspec.it "discovers a .cpphs file" $ do expectDiscover- [["M.cpphs"]]+ (".", [["M.cpphs"]]) "library\n -- cabal-gild: discover\n exposed-modules:" "library\n -- cabal-gild: discover\n exposed-modules: M\n" Hspec.it "discovers a .hsig file" $ do expectDiscover- [["M.hsig"]]+ (".", [["M.hsig"]]) "library\n -- cabal-gild: discover\n exposed-modules:" "library\n -- cabal-gild: discover\n exposed-modules: M\n" Hspec.it "discovers a .lhsig file" $ do expectDiscover- [["M.lhsig"]]+ (".", [["M.lhsig"]]) "library\n -- cabal-gild: discover\n exposed-modules:" "library\n -- cabal-gild: discover\n exposed-modules: M\n" Hspec.it "discovers a signature" $ do expectDiscover- [["S.hsig"]]+ (".", [["S.hsig"]]) "library\n -- cabal-gild: discover\n signatures:" "library\n -- cabal-gild: discover\n signatures: S\n" @@ -1181,73 +1181,73 @@ Hspec.it "discovers from the currently directory explicitly" $ do expectDiscover- [["M.hs"]]+ (".", [["M.hs"]]) "library\n -- cabal-gild: discover .\n exposed-modules:" "library\n -- cabal-gild: discover .\n exposed-modules: M\n" Hspec.it "discovers from multiple directories" $ do expectDiscover- [["d", "M.hs"], ["e", "N.hs"]]+ (".", [["d", "M.hs"], ["e", "N.hs"]]) "library\n -- cabal-gild: discover d e\n exposed-modules:" "library\n -- cabal-gild: discover d e\n exposed-modules:\n M\n N\n" Hspec.it "discovers from a quoted directory" $ do expectDiscover- [["d", "M.hs"]]+ (".", [["d", "M.hs"]]) "library\n -- cabal-gild: discover \"d\"\n exposed-modules:" "library\n -- cabal-gild: discover \"d\"\n exposed-modules: M\n" Hspec.it "discovers from a directory with a space" $ do expectDiscover- [["s p", "M.hs"]]+ (".", [["s p", "M.hs"]]) "library\n -- cabal-gild: discover \"s p\"\n exposed-modules:" "library\n -- cabal-gild: discover \"s p\"\n exposed-modules: M\n" Hspec.it "discovers from the current directory by default" $ do expectDiscover- [["M.hs"]]+ (".", [["M.hs"]]) "library\n -- cabal-gild: discover\n exposed-modules:" "library\n -- cabal-gild: discover\n exposed-modules: M\n" Hspec.it "allows excluding a path when discovering" $ do expectDiscover- [["M.hs"], ["N.hs"]]+ (".", [["M.hs"], ["N.hs"]]) "library\n -- cabal-gild: discover --exclude M.hs\n exposed-modules:" "library\n -- cabal-gild: discover --exclude M.hs\n exposed-modules: N\n" Hspec.it "allows excluding a nested POSIX path" $ do expectDiscover- [["A", "M.hs"], ["B", "M.hs"]]+ (".", [["A", "M.hs"], ["B", "M.hs"]]) "library\n -- cabal-gild: discover --exclude B/M.hs\n exposed-modules:" "library\n -- cabal-gild: discover --exclude B/M.hs\n exposed-modules: A.M\n" Hspec.it "allows excluding a nested Windows path" $ do expectDiscover- [["A", "M.hs"], ["B", "M.hs"]]+ (".", [["A", "M.hs"], ["B", "M.hs"]]) "library\n -- cabal-gild: discover --exclude B\\M.hs\n exposed-modules:" "library\n -- cabal-gild: discover --exclude B\\M.hs\n exposed-modules: A.M\n" Hspec.it "allows excluding a relative POSIX path" $ do expectDiscover- [["M.hs"], ["N.hs"]]+ (".", [["M.hs"], ["N.hs"]]) "library\n -- cabal-gild: discover --exclude ./M.hs\n exposed-modules:" "library\n -- cabal-gild: discover --exclude ./M.hs\n exposed-modules: N\n" Hspec.it "allows excluding a relative Windows path" $ do expectDiscover- [["M.hs"], ["N.hs"]]+ (".", [["M.hs"], ["N.hs"]]) "library\n -- cabal-gild: discover --exclude .\\M.hs\n exposed-modules:" "library\n -- cabal-gild: discover --exclude .\\M.hs\n exposed-modules: N\n" Hspec.it "allows excluding multiple paths" $ do expectDiscover- [["M.hs"], ["N.hs"], ["O.hs"]]+ (".", [["M.hs"], ["N.hs"], ["O.hs"]]) "library\n -- cabal-gild: discover --exclude M.hs --exclude O.hs\n exposed-modules:" "library\n -- cabal-gild: discover --exclude M.hs --exclude O.hs\n exposed-modules: N\n" Hspec.it "allows excluding paths that don't match anything" $ do expectDiscover- [["M.hs"]]+ (".", [["M.hs"]]) "library\n -- cabal-gild: discover --exclude N.hs\n exposed-modules:" "library\n -- cabal-gild: discover --exclude N.hs\n exposed-modules: M\n" @@ -1257,20 +1257,20 @@ runGild ["--input", FilePath.combine d "io.cabal"] [(Input.File $ FilePath.combine d "io.cabal", String.toUtf8 "library\n -- cabal-gild: discover src --exclude src/N.hs\n exposed-modules:")]- [[d, "src", "M.hs"], [d, "src", "N.hs"]]+ (d, [["src", "M.hs"], ["src", "N.hs"]]) a `Hspec.shouldSatisfy` Either.isRight w `Hspec.shouldBe` [] s `Hspec.shouldBe` Map.singleton Output.Stdout (String.toUtf8 "library\n -- cabal-gild: discover src --exclude src/N.hs\n exposed-modules: M\n") Hspec.it "allows excluding simple wildcards" $ do expectDiscover- [["M.hs"], ["MSpec.hs"]]+ (".", [["M.hs"], ["MSpec.hs"]]) "library\n -- cabal-gild: discover --exclude *Spec.hs\n exposed-modules:" "library\n -- cabal-gild: discover --exclude *Spec.hs\n exposed-modules: M\n" Hspec.it "allows excluding complex wildcards" $ do expectDiscover- [["A.hs"], ["A", "B.hs"], ["X", "C.hs"], ["A", "X", "D.hs"]]+ (".", [["A.hs"], ["A", "B.hs"], ["X", "C.hs"], ["A", "X", "D.hs"]]) "library\n -- cabal-gild: discover --exclude **/X/**/*.hs\n exposed-modules:" "library\n -- cabal-gild: discover --exclude **/X/**/*.hs\n exposed-modules:\n A\n A.B\n" @@ -1279,7 +1279,7 @@ runGild [] [(Input.Stdin, String.toUtf8 "-- cabal-gild: discover --unknown\nsignatures:")]- []+ (".", []) a `shouldBeFailure` UnknownOption.UnknownOption "--unknown" w `Hspec.shouldBe` [] s `Hspec.shouldBe` Map.empty@@ -1289,20 +1289,20 @@ runGild [] [(Input.Stdin, String.toUtf8 "-- cabal-gild: discover --exclude\nsignatures:")]- []+ (".", []) a `shouldBeFailure` InvalidOption.InvalidOption "option `--exclude' requires an argument PATTERN" w `Hspec.shouldBe` [] s `Hspec.shouldBe` Map.empty Hspec.it "retains comments when discovering" $ do expectDiscover- [["M.hs"]]+ (".", [["M.hs"]]) "library\n -- cabal-gild: discover\n exposed-modules:\n -- c\n N" "library\n -- cabal-gild: discover\n exposed-modules:\n -- c\n M\n" Hspec.it "concatenates comments when discovering" $ do expectDiscover- [["M.hs"]]+ (".", [["M.hs"]]) "library\n -- cabal-gild: discover\n exposed-modules:\n -- c\n N\n -- d\n O" "library\n -- cabal-gild: discover\n exposed-modules:\n -- c\n -- d\n M\n" @@ -1388,7 +1388,7 @@ Hspec.it "keeps output on multiple lines for pragmas" $ do expectDiscover- [["M.hs"]]+ (".", [["M.hs"]]) "library\n -- cabal-gild: discover\n exposed-modules:\n ..." "library\n -- cabal-gild: discover\n exposed-modules:\n M\n" @@ -1399,13 +1399,13 @@ Hspec.it "supports including a module" $ do expectDiscover- [["M.hs"], ["N.hs"]]+ (".", [["M.hs"], ["N.hs"]]) "library\n -- cabal-gild: discover --include M.hs\n exposed-modules:" "library\n -- cabal-gild: discover --include M.hs\n exposed-modules: M\n" Hspec.it "supports including a pattern" $ do expectDiscover- [["M1.hs"], ["M2.hs"], ["N.hs"]]+ (".", [["M1.hs"], ["M2.hs"], ["N.hs"]]) "library\n -- cabal-gild: discover --include M*.hs\n exposed-modules:" "library\n -- cabal-gild: discover --include M*.hs\n exposed-modules:\n M1\n M2\n" @@ -1414,19 +1414,19 @@ -- `*X.hs`. That's because it's relative to the package description, not -- the directories listed in the discover pragma. expectDiscover- [["a", "AX.hs"], ["a", "M.hs"], ["b", "BX.hs"], ["b", "N.hs"]]+ (".", [["a", "AX.hs"], ["a", "M.hs"], ["b", "BX.hs"], ["b", "N.hs"]]) "library\n -- cabal-gild: discover a b --include **/*X.hs\n exposed-modules:" "library\n -- cabal-gild: discover a b --include **/*X.hs\n exposed-modules:\n AX\n BX\n" Hspec.it "supports including with multiple patterns" $ do expectDiscover- [["M.hs"], ["N.hs"], ["O.hs"]]+ (".", [["M.hs"], ["N.hs"], ["O.hs"]]) "library\n -- cabal-gild: discover --include M.hs --include N.hs\n exposed-modules:" "library\n -- cabal-gild: discover --include M.hs --include N.hs\n exposed-modules:\n M\n N\n" Hspec.it "supports including and excluding at the same time" $ do expectDiscover- [["XA.hs"], ["XASpec.hs"]]+ (".", [["XA.hs"], ["XASpec.hs"]]) "library\n -- cabal-gild: discover --include X*.hs --exclude *Spec.hs\n exposed-modules:" "library\n -- cabal-gild: discover --include X*.hs --exclude *Spec.hs\n exposed-modules: XA\n" @@ -1434,7 +1434,7 @@ -- `a.M` is not a valid module name because `a` is lowercase. So it should -- not be discovered even though it is included. expectDiscover- [["a", "M.hs"]]+ (".", [["a", "M.hs"]]) "library\n -- cabal-gild: discover --include a/**\n exposed-modules:" "library\n -- cabal-gild: discover --include a/**\n exposed-modules:\n" @@ -1442,7 +1442,7 @@ -- Unlike the previous test, the module `M` should be discovered because -- the directory `a` will be stripped off. expectDiscover- [["a", "M.hs"]]+ (".", [["a", "M.hs"]]) "library\n -- cabal-gild: discover a --include a/**\n exposed-modules:" "library\n -- cabal-gild: discover a --include a/**\n exposed-modules: M\n" @@ -1452,68 +1452,68 @@ runGild ["--input", FilePath.combine d "io.cabal"] [(Input.File $ FilePath.combine d "io.cabal", String.toUtf8 "library\n -- cabal-gild: discover src --include src/M.hs\n exposed-modules:")]- [[d, "src", "M.hs"], [d, "src", "N.hs"]]+ (d, [["src", "M.hs"], ["src", "N.hs"]]) a `Hspec.shouldSatisfy` Either.isRight w `Hspec.shouldBe` [] s `Hspec.shouldBe` Map.singleton Output.Stdout (String.toUtf8 "library\n -- cabal-gild: discover src --include src/M.hs\n exposed-modules: M\n") Hspec.it "discovers asm-sources" $ do expectDiscover- [["example.txt"]]+ (".", [["example.txt"]]) "-- cabal-gild: discover\nasm-sources:" "-- cabal-gild: discover\nasm-sources: example.txt\n" Hspec.it "discovers c-sources" $ do expectDiscover- [["example.txt"]]+ (".", [["example.txt"]]) "-- cabal-gild: discover\nc-sources:" "-- cabal-gild: discover\nc-sources: example.txt\n" Hspec.it "discovers cxx-sources" $ do expectDiscover- [["example.txt"]]+ (".", [["example.txt"]]) "-- cabal-gild: discover\ncxx-sources:" "-- cabal-gild: discover\ncxx-sources: example.txt\n" Hspec.it "discovers data-files" $ do expectDiscover- [["example.txt"]]+ (".", [["example.txt"]]) "-- cabal-gild: discover\ndata-files:" "-- cabal-gild: discover\ndata-files: example.txt\n" Hspec.it "discovers extra-doc-files" $ do expectDiscover- [["example.txt"]]+ (".", [["example.txt"]]) "-- cabal-gild: discover\nextra-doc-files:" "-- cabal-gild: discover\nextra-doc-files: example.txt\n" Hspec.it "discovers extra-source-files" $ do expectDiscover- [["example.txt"]]+ (".", [["example.txt"]]) "-- cabal-gild: discover\nextra-source-files:" "-- cabal-gild: discover\nextra-source-files: example.txt\n" Hspec.it "discovers includes" $ do expectDiscover- [["example.txt"]]+ (".", [["example.txt"]]) "-- cabal-gild: discover\nincludes:" "-- cabal-gild: discover\nincludes: example.txt\n" Hspec.it "discovers install-includes" $ do expectDiscover- [["example.txt"]]+ (".", [["example.txt"]]) "-- cabal-gild: discover\ninstall-includes:" "-- cabal-gild: discover\ninstall-includes: example.txt\n" Hspec.it "discovers js-sources" $ do expectDiscover- [["example.txt"]]+ (".", [["example.txt"]]) "-- cabal-gild: discover\njs-sources:" "-- cabal-gild: discover\njs-sources: example.txt\n" Hspec.it "discovers license-files" $ do expectDiscover- [["example.txt"]]+ (".", [["example.txt"]]) "-- cabal-gild: discover\nlicense-files:" "-- cabal-gild: discover\nlicense-files: example.txt\n" @@ -1544,8 +1544,8 @@ Directory.createDirectory "N" writeFile (FilePath.combine "N" "M1.hs") "" writeFile (FilePath.combine "N" "M2.hs") ""- Gild.mainWith ["--input=i.cabal", "--output=o.cabal"]- readFile "o.cabal"+ Gild.mainWith ["--input=i.cabal", "--output=r.cabal"]+ readFile "r.cabal" `Hspec.shouldReturn` unlines [ "library", " -- cabal-gild: discover --exclude=.\\M2.hs --exclude=N/M1.hs",@@ -1553,6 +1553,16 @@ " M1", " N.M2" ]+ d <- Directory.getCurrentDirectory+ Gild.mainWith ["--input", FilePath.combine d "i.cabal", "--output=a.cabal"]+ readFile "a.cabal"+ `Hspec.shouldReturn` unlines+ [ "library",+ " -- cabal-gild: discover --exclude=.\\M2.hs --exclude=N/M1.hs",+ " exposed-modules:",+ " M1",+ " N.M2"+ ] withTemporaryDirectory :: IO () -> IO () withTemporaryDirectory =@@ -1571,11 +1581,11 @@ x -> x `Hspec.shouldSatisfy` Either.isLeft expectGilded :: (Stack.HasCallStack) => String -> String -> Hspec.Expectation-expectGilded = expectDiscover []+expectGilded = expectDiscover (".", []) expectStable :: (Stack.HasCallStack) =>- [[String]] ->+ (String, [[String]]) -> ByteString.ByteString -> Hspec.Expectation expectStable files input = do@@ -1589,7 +1599,7 @@ expectDiscover :: (Stack.HasCallStack) =>- [[String]] ->+ (String, [[String]]) -> String -> String -> Hspec.Expectation@@ -1606,13 +1616,13 @@ runGild :: [String] -> [(Input.Input, ByteString.ByteString)] ->- [[String]] ->+ (String, [[String]]) -> (Either E (), S, W) runGild arguments inputs files = runTest (Gild.mainWith arguments) ( Map.fromList inputs,- Map.singleton "." (fmap FilePath.joinPath files)+ fmap FilePath.joinPath <$> uncurry Map.singleton files ) Map.empty