Merge branch 'master' of http://darcs.haskell.org//testsuite
[ghc.git] / testsuite / tests / driver / T4437.hs
1
2 module Main (main) where
3
4 import Control.Monad
5 import Data.List
6 import DynFlags
7 import Language.Haskell.Extension
8
9 main :: IO ()
10 main = do
11 let ghcExtensions = [ ext | (ext, _, _) <- xFlags ]
12 cabalExtensions = map show [ toEnum 0 :: KnownExtension .. ]
13 ghcOnlyExtensions = ghcExtensions \\ cabalExtensions
14 cabalOnlyExtensions = cabalExtensions \\ ghcExtensions
15 check "GHC-only flags" expectedGhcOnlyExtensions ghcOnlyExtensions
16 check "Cabal-only flags" expectedCabalOnlyExtensions cabalOnlyExtensions
17
18 check :: String -> [String] -> [String] -> IO ()
19 check title expected got
20 = do let unexpected = got \\ expected
21 missing = expected \\ got
22 showProblems problemType problems
23 = unless (null problems) $
24 do putStrLn (title ++ ": " ++ problemType)
25 putStrLn "-----"
26 mapM_ putStrLn problems
27 putStrLn "-----"
28 putStrLn ""
29 showProblems "Unexpected flags" unexpected
30 showProblems "Missing flags" missing
31
32 expectedGhcOnlyExtensions :: [String]
33 expectedGhcOnlyExtensions = ["ParallelArrays",
34 "RelaxedLayout",
35 "DeriveGeneric",
36 "DefaultSignatures",
37 "InterruptibleFFI",
38 "AlternativeLayoutRule",
39 "AlternativeLayoutRuleTransitional",
40 "MonadComprehensions",
41 "TraditionalRecordSyntax",
42 "DataKinds",
43 "PolyKinds",
44 "ExplicitNamespaces",
45 "InstanceSigs",
46 "CApiFFI"]
47
48 expectedCabalOnlyExtensions :: [String]
49 expectedCabalOnlyExtensions = ["Generics",
50 "ExtensibleRecords",
51 "RestrictedTypeSynonyms",
52 "HereDocuments",
53 "NewQualifiedOperators",
54 "XmlSyntax",
55 "RegularPatterns",
56 "SafeImports",
57 "Safe",
58 "Trustworthy"]
59