summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2011-09-27 00:08:47 +0100
committerIan Lynagh <igloo@earth.li>2011-09-27 00:08:47 +0100
commit11152ac00090709e1b3d1cf2823e12cd7cfbed16 (patch)
tree3ab4c60286865cce0107e47b40748a2679065514 /testsuite
parent25d6a04a356ac8349c4eae585379c3ff22418035 (diff)
downloadhaskell-11152ac00090709e1b3d1cf2823e12cd7cfbed16.tar.gz
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.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/driver/T4437.hs62
1 files changed, 45 insertions, 17 deletions
diff --git a/testsuite/tests/driver/T4437.hs b/testsuite/tests/driver/T4437.hs
index 64634a9c74..f237cd21a6 100644
--- a/testsuite/tests/driver/T4437.hs
+++ b/testsuite/tests/driver/T4437.hs
@@ -1,26 +1,54 @@
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"]