Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/48d83633586f8500114ff7a80b2da077db795f8a

>---------------------------------------------------------------

commit 48d83633586f8500114ff7a80b2da077db795f8a
Author: Ian Lynagh <[email protected]>
Date:   Tue Sep 27 00:08:47 2011 +0100

    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.

>---------------------------------------------------------------

 tests/driver/T4437.hs |   62 +++++++++++++++++++++++++++++++++++-------------
 1 files changed, 45 insertions(+), 17 deletions(-)

diff --git a/tests/driver/T4437.hs b/tests/driver/T4437.hs
index 64634a9..f237cd2 100644
--- a/tests/driver/T4437.hs
+++ b/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"]
 



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to