summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorSean Gillespie <sean@mistersg.net>2016-06-10 12:53:37 +0200
committerBen Gamari <ben@smart-cactus.org>2016-06-10 16:22:34 +0200
commitbcb419a41754bbd883973c96d4b0bca4639e4f2d (patch)
treefaefc732530b8e886f49886f632514dbc1326e66 /testsuite
parent47d81732022e0327f7a5798898b40d1f1bdbb157 (diff)
downloadhaskell-bcb419a41754bbd883973c96d4b0bca4639e4f2d.tar.gz
Fix #12099: Remove bogus flags
Remove -fwarn- and -fno-warn- from flagsForCompletion Testcase: Fix linter error on T12099 For Issue #12099 Reviewers: austin, thomie, bgamari Reviewed By: austin, thomie, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2281 GHC Trac Issues: #12099
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/ghc-api/T12099.hs27
-rw-r--r--testsuite/tests/ghc-api/T12099.stdout0
-rw-r--r--testsuite/tests/ghc-api/all.T1
3 files changed, 28 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
diff --git a/testsuite/tests/ghc-api/T12099.stdout b/testsuite/tests/ghc-api/T12099.stdout
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/ghc-api/T12099.stdout
diff --git a/testsuite/tests/ghc-api/all.T b/testsuite/tests/ghc-api/all.T
index 12c64ebf80..377c1e3987 100644
--- a/testsuite/tests/ghc-api/all.T
+++ b/testsuite/tests/ghc-api/all.T
@@ -26,3 +26,4 @@ test('T9015', extra_run_opts('"' + config.libdir + '"'),
['-package ghc'])
test('T11579', extra_run_opts('"' + config.libdir + '"'), compile_and_run,
['-package ghc'])
+test('T12099', normal, compile_and_run, ['-package ghc'])