import Test.Cabal.Prelude

-- Test that all the respective defines -DNOERROR... specified in various ways
-- all end up routed to the C compiler. Otherwise the C file we depend on will
-- not compile.
main = setupAndCabalTest $ do
  skipUnlessGhcVersion ">= 8.8"
  isWin <- isWindows
  ghc94 <- isGhcVersion "== 9.4.*"
  env   <- getTestEnv
  let pwd      = testCurrentDir env
      customCC = pwd ++ "/custom-cc" ++ if isWin then ".bat" else ""

  expectBrokenIf (isWin && ghc94) 8451 $ do
    setup "configure"
      [ "--ghc-option=-DNOERROR1"
      , "--ghc-option=-optc=-DNOERROR2"
      , "--ghc-option=-optP=-DNOERROR3"
      , "--with-gcc=" ++ customCC
      ]
    setup "build" ["-v2"]
