makeMainTest :: (String, IO (), IO (), Bool, [TestSuite], Opts) -> Test
makeMainTest (name, setup, cleanup, shouldPass, suites, opts) =
  let
    runTest =
      do
        setup
        out <- topLevel suites opts
        cleanup
        case out of
          Left msgs ->
            if not shouldPass
              then return (Finished Pass)
              else return (Finished (Fail ("Expected test to pass, " ++
                                           "but failed with\n" ++
                                           intercalate "\n" (map Strict.unpack msgs))))
          Right _ ->
            if shouldPass
              then return (Finished Pass)
              else return (Finished (Fail "Expected test to fail"))
    testInstance = TestInstance { name = name, tags = [], options = [],
                                  setOption = (\_ _ -> return testInstance),
                                  run = runTest }
  in
    Test testInstance
makeMainTest :: (String, IO (), IO (), Bool, [TestSuite], Opts) -> Test
makeMainTest (name, setup, cleanup, shouldPass, suites, opts) =
  let
    runTest =
      do
        setup
        out <- topLevel suites opts
        cleanup
        case out of
          Left msgs ->
            if not shouldPass
              then return (Finished Pass)
              else return (Finished (Fail ("Expected test to pass, " ++
                                           "but failed with\n" ++
                                           intercalate "\n" (map Strict.unpack msgs))))
          Right _ ->
            if shouldPass
              then return (Finished Pass)
              else return (Finished (Fail "Expected test to fail"))
    testInstance = TestInstance { name = name, tags = [], options = [],
                                  setOption = (\_ _ -> return testInstance),
                                  run = runTest }
  in
    Test testInstance
makeMainTest (name, setup, cleanup, shouldPass, suites, opts) =
  let
    runTest =
      do
        setup
        out <- topLevel suites opts
        cleanup
        case out of
          Left msgs ->
            if not shouldPass
              then return (Finished Pass)
              else return (Finished (Fail ("Expected test to pass, " ++
                                           "but failed with\n" ++
                                           intercalate "\n" (map Strict.unpack msgs))))
          Right _ ->
            if shouldPass
              then return (Finished Pass)
              else return (Finished (Fail "Expected test to fail"))
    testInstance = TestInstance { name = name, tags = [], options = [],
                                  setOption = (\_ _ -> return testInstance),
                                  run = runTest }
  in
    Test testInstance