Commit 11152ac0 authored by Ian Lynagh's avatar Ian Lynagh

Make T4437 more thorough, and update it

It now knows about all the differences between the extensions that
GHC knows, and the extensions that Cabal knows.
parent 25d6a04a
module Main (main) where
import Control.Monad
import Data.List
import DynFlags
import Language.Haskell.Extension
main :: IO ()
main = do let ghcExtensions = [ ext | (ext, _, _, _) <- xFlags ]
cabalExtensions = map show [ toEnum 0 :: KnownExtension .. ]
ghcOnlyExtensions = ghcExtensions \\ cabalExtensions
-- These are extensions which are deliberately not yet
-- registered with Cabal
expectedGhcOnlyExtensions
= ["ParallelArrays",
"RelaxedLayout",
"DeriveGeneric",
"DefaultSignatures",
"InterruptibleFFI",
"AlternativeLayoutRule",
"AlternativeLayoutRuleTransitional",
"MonadComprehensions"]
unexpectedGhcOnlyExtension = ghcOnlyExtensions
\\ expectedGhcOnlyExtensions
mapM_ putStrLn unexpectedGhcOnlyExtension
main = do
let ghcExtensions = [ ext | (ext, _, _, _) <- xFlags ]
cabalExtensions = map show [ toEnum 0 :: KnownExtension .. ]
ghcOnlyExtensions = ghcExtensions \\ cabalExtensions
cabalOnlyExtensions = cabalExtensions \\ ghcExtensions
check "GHC-only flags" expectedGhcOnlyExtensions ghcOnlyExtensions
check "Cabal-only flags" expectedCabalOnlyExtensions cabalOnlyExtensions
check :: String -> [String] -> [String] -> IO ()
check title expected got
= do let unexpected = got \\ expected
missing = expected \\ got
showProblems problemType problems
= unless (null problems) $
do putStrLn (title ++ ": " ++ problemType)
putStrLn "-----"
mapM_ putStrLn problems
putStrLn "-----"
putStrLn ""
showProblems "Unexpected flags" unexpected
showProblems "Missing flags" missing
expectedGhcOnlyExtensions :: [String]
expectedGhcOnlyExtensions = ["ParallelArrays",
"RelaxedLayout",
"DeriveGeneric",
"DefaultSignatures",
"InterruptibleFFI",
"AlternativeLayoutRule",
"AlternativeLayoutRuleTransitional",
"MonadComprehensions",
"TraditionalRecordSyntax"]
expectedCabalOnlyExtensions :: [String]
expectedCabalOnlyExtensions = ["Generics",
"ExtensibleRecords",
"RestrictedTypeSynonyms",
"HereDocuments",
"NewQualifiedOperators",
"XmlSyntax",
"RegularPatterns",
"SafeImports",
"Safe",
"Trustworthy"]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment