Merge pull request #252 from eagletmt/suppress-empty-line
Suppress empty line
This commit is contained in:
commit
d8388c0e43
@ -57,7 +57,11 @@ inter c bs = foldr1 (\x y -> x . (c:) . y) bs
|
||||
|
||||
convert :: ToString a => Options -> a -> String
|
||||
convert opt@Options { outputStyle = LispStyle } x = toLisp opt x "\n"
|
||||
convert opt@Options { outputStyle = PlainStyle } x = toPlain opt x "\n"
|
||||
convert opt@Options { outputStyle = PlainStyle } x
|
||||
| str == "\n" = ""
|
||||
| otherwise = str
|
||||
where
|
||||
str = toPlain opt x "\n"
|
||||
|
||||
class ToString a where
|
||||
toLisp :: Options -> a -> Builder
|
||||
|
@ -34,3 +34,10 @@ spec = do
|
||||
cradle <- findCradleWithoutSandbox
|
||||
res <- checkSyntax defaultOptions cradle ["Baz.hs"]
|
||||
res `shouldSatisfy` ("Baz.hs:5:1:Warning:" `isPrefixOf`)
|
||||
|
||||
context "without errors" $ do
|
||||
it "doesn't output empty line" $ do
|
||||
withDirectory_ "test/data/ghc-mod-check/Data" $ do
|
||||
cradle <- findCradleWithoutSandbox
|
||||
res <- checkSyntax defaultOptions cradle ["Foo.hs"]
|
||||
res `shouldBe` ""
|
||||
|
@ -10,3 +10,7 @@ spec = do
|
||||
res <- lintSyntax defaultOptions "test/data/hlint.hs"
|
||||
res `shouldBe` "test/data/hlint.hs:4:8: Error: Redundant do\NULFound:\NUL do putStrLn \"Hello, world!\"\NULWhy not:\NUL putStrLn \"Hello, world!\"\n"
|
||||
|
||||
context "without suggestions" $ do
|
||||
it "doesn't output empty line" $ do
|
||||
res <- lintSyntax defaultOptions "test/data/ghc-mod-check/Data/Foo.hs"
|
||||
res `shouldBe` ""
|
||||
|
Loading…
Reference in New Issue
Block a user