From 1a53582a216147fe3f5d79fadda151cb149b9bdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gr=C3=B6ber?= Date: Wed, 5 Aug 2015 04:05:43 +0200 Subject: [PATCH] Add failing test for missing warnings #507 --- ghc-mod.cabal | 1 + test/CheckSpec.hs | 5 +++++ test/data/check-missing-warnings/DesugarWarnings.hs | 5 +++++ 3 files changed, 11 insertions(+) create mode 100644 test/data/check-missing-warnings/DesugarWarnings.hs diff --git a/ghc-mod.cabal b/ghc-mod.cabal index d34566c..8891657 100644 --- a/ghc-mod.cabal +++ b/ghc-mod.cabal @@ -71,6 +71,7 @@ Extra-Source-Files: ChangeLog test/data/pattern-synonyms/*.hs test/data/quasi-quotes/*.hs test/data/template-haskell/*.hs + test/data/check-missing-warnings/*.hs Library Default-Language: Haskell2010 diff --git a/test/CheckSpec.hs b/test/CheckSpec.hs index f240f98..91dbfa9 100644 --- a/test/CheckSpec.hs +++ b/test/CheckSpec.hs @@ -52,3 +52,8 @@ spec = do withDirectory_ "test/data/ghc-mod-check/lib/Data" $ do res <- runD $ checkSyntax ["Foo.hs"] res `shouldBe` "" + + it "emits warnings generated in GHC's desugar stage" $ do + withDirectory_ "test/data/check-missing-warnings" $ do + res <- runD $ checkSyntax ["DesugarWarnings.hs"] + res `shouldBe` "test/data/check-missing-warnings/DesugarWarnings.hs:5:9:Warning: Pattern match(es) are non-exhaustiveIn a case alternative: Patterns not matched: _ : _" diff --git a/test/data/check-missing-warnings/DesugarWarnings.hs b/test/data/check-missing-warnings/DesugarWarnings.hs new file mode 100644 index 0000000..9d80559 --- /dev/null +++ b/test/data/check-missing-warnings/DesugarWarnings.hs @@ -0,0 +1,5 @@ +module Warnings (zoo) where + +zoo :: [a] -> () +zoo x = case x of + [] -> undefined