summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-api/T12099.hs
blob: d5d5d544453cf23e6d82f9faecb9cbe5c58c2b8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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