buildwrapper 0.5.1 → 0.5.2
raw patch · 3 files changed
+59/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- buildwrapper.cabal +1/−1
- src/Language/Haskell/BuildWrapper/Src.hs +3/−1
- test/Language/Haskell/BuildWrapper/Tests.hs +55/−0
buildwrapper.cabal view
@@ -1,5 +1,5 @@ name: buildwrapper -version: 0.5.1 +version: 0.5.2 cabal-version: >= 1.8 build-type: Simple license: BSD3
src/Language/Haskell/BuildWrapper/Src.hs view
@@ -27,7 +27,9 @@ -> [String] -- ^ options -> IO (ParseResult (Module SrcSpanInfo, [Comment])) getHSEAST input options=do - let exts=map classifyExtension options + -- we add MultiParamTypeClasses because we may need it if the module we're parsing uses a type class with multiple parameters, which doesn't require the PRAGMA (only in the module DEFINING the type class) + -- we cannot add all the extensions because some conflict (NewQualifiedOperators breaks code with old operator syntax I think) + let exts=MultiParamTypeClasses : map classifyExtension options let extsFull=if "-fglasgow-exts" `elem` options then exts ++ glasgowExts else exts
test/Language/Haskell/BuildWrapper/Tests.hs view
@@ -44,6 +44,8 @@ testOutlineImportExport, testOutlineLiterate, testOutlineComments, + testOutlineMultiParam, + testOutlineOperator, testPreviewTokenTypes, testThingAtPoint , testThingAtPointNotInCabal, @@ -660,6 +662,59 @@ mapM_ (uncurry (assertEqual "imports")) (zip imps is) )) + +testOutlineMultiParam :: (APIFacade a)=> a -> Test +testOutlineMultiParam api= TestLabel "testOutlineMultiParam" (TestCase ( do + root<-createTestProject + synchronize api root False + let rel="src"</>"A.hs" + write api root rel $ unlines [ + "{-# LANGUAGE MultiParamTypeClasses #-}", + "module A where", + "", + "class C a b", + " where", + " c :: a -> b" + ] + let rel2="src"</>"B"</>"C.hs" + write api root rel2 $ unlines [ + "module B.C where", + "", + "import A", + "myC ::", + " (C a b)", + " => ", + " a -> b", + "myC = c" + ] + (_,nsErrors3f)<-getBuildFlags api root rel2 + assertBool "errors or warnings on nsErrors3f" (null nsErrors3f) + (OutlineResult or _ _,nsErrors1)<-getOutline api root rel2 + assertBool ("errors or warnings on getOutline:"++show nsErrors1) (null nsErrors1) + assertBool "no outline" (not $ null or) + )) + +testOutlineOperator :: (APIFacade a)=> a -> Test +testOutlineOperator api= TestLabel "testOutlineMultiParam" (TestCase ( do + root<-createTestProject + synchronize api root False + let rel="src"</>"A.hs" + write api root rel $ unlines [ + "{-# LANGUAGE MultiParamTypeClasses #-}", + "module A ( Collection (", + " (>-)", + " )", + " )where", + " infixl 5 >-", + " class Collection a where", + " (>-) :: Eq b => a b -> a b -> a b" + ] + (_,nsErrors3f)<-getBuildFlags api root rel + assertBool "errors or warnings on nsErrors3f" (null nsErrors3f) + (OutlineResult or _ _,nsErrors1)<-getOutline api root rel + assertBool ("errors or warnings on getOutline:"++show nsErrors1) (null nsErrors1) + assertBool "no outline" (not $ null or) + )) testPreviewTokenTypes :: (APIFacade a)=> a -> Test testPreviewTokenTypes api= TestLabel "testPreviewTokenTypes" (TestCase ( do