summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-api/T12099.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/ghc-api/T12099.hs')
-rw-r--r--testsuite/tests/ghc-api/T12099.hs27
1 files changed, 27 insertions, 0 deletions
diff --git a/testsuite/tests/ghc-api/T12099.hs b/testsuite/tests/ghc-api/T12099.hs
new file mode 100644
index 0000000000..d5d5d54445
--- /dev/null
+++ b/testsuite/tests/ghc-api/T12099.hs
@@ -0,0 +1,27 @@
+module Main where
+
+import DynFlags
+
+import Control.Monad
+import Data.List
+
+-- Verify bogus flags aren't printed on flagsForCompletion and
+-- allNonDeprecatedFlags:
+-- * -fwarn-
+-- * -fno-warn-
+--
+-- Should print nothing
+main :: IO ()
+main = mapM_ print $ fwarnFlags (flagsForCompletion True) ++ nonDepFwarnFlags
+
+-- Get flags beginning with -fwarn- and -fno-warn-
+fwarnFlags :: [String] -> [String]
+fwarnFlags = filter isFwarn
+ where isFwarn flag = any (flip isPrefixOf $ flag) ["-fwarn-", "-fno-warn"]
+
+-- Get suggested flags for -fwarn-, -fno-warn-
+nonDepFwarnFlags :: [String]
+nonDepFwarnFlags = filter isFwarn allNonDeprecatedFlags
+ where isFwarn "-fwarn-" = True
+ isFwarn "-fno-warn-" = True
+ isFwarn _ = False