1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 18:23:44 +03:00
semantic/test/SpecIntegration.hs

25 lines
735 B
Haskell

{-# LANGUAGE FlexibleContexts #-}
module Main where
import Prologue
import Prelude (String)
import Data.List
import Data.List.Utils
import qualified IntegrationFormatSpec
import Test.Hspec
import System.Environment (withArgs)
main :: IO ()
main = do
args <- getArgs
let (language, rest) = parseCustomArgs args
withArgs rest . hspec . parallel $ describe "Integration Format Specs" (IntegrationFormatSpec.spec language)
where
parseCustomArgs :: [String] -> (Maybe String, [String])
parseCustomArgs args = case partitioned of
(l:_, rest) -> (toLang l, rest)
_ -> (Nothing, args)
where
partitioned = partition (startswith "--language") args
toLang s = Just $ replace "--language=" "" s