packages feed

agda-language-server-10: test/Test.hs

{-# LANGUAGE CPP #-}

import Data.Proxy (Proxy (..))
import Data.Typeable (Typeable)
import qualified Test.Hover as Hover
import qualified Test.LSP as LSP
import qualified Test.Smoke as Smoke
import qualified Test.SrcLoc as SrcLoc
import qualified Test.Version as Version
#if defined(wasm32_HOST_ARCH)
import qualified Test.WASM as WASM
#endif
import Test.Tasty
import Test.Tasty.Options

-- Define the custom option
newtype AlsPathOption = AlsPathOption FilePath
  deriving (Show, Typeable)

instance IsOption AlsPathOption where
  defaultValue = AlsPathOption "als"
  parseValue = Just . AlsPathOption
  optionName = return "als-path"
  optionHelp = return "Path to the als executable"

main :: IO ()
main = do
  let opts = [Option (Proxy :: Proxy AlsPathOption)]
      ingredients = includingOptions opts : defaultIngredients
  defaultMainWithIngredients ingredients tests

tests :: TestTree
tests = askOption $ \(AlsPathOption alsPath) ->
  testGroup
    "Tests"
    [ SrcLoc.tests,
      Version.tests,
      LSP.tests alsPath,
      Hover.tests alsPath,
      Smoke.tests alsPath
#if defined(wasm32_HOST_ARCH)
    , WASM.tests alsPath
#endif
    ]