on 73613bd help sign in
patch/test/Reflex/Test/RunAll.hs
44 lines 1.3 kB history raw
1{-# LANGUAGE ConstraintKinds, GADTs, RankNTypes, FlexibleInstances, FlexibleContexts, MultiParamTypeClasses, GeneralizedNewtypeDeriving #-}
3module Main (main) where
5import Reflex.Test
7import qualified Reflex.Bench.Focused as Focused
8import qualified Reflex.Test.Micro as Micro
9import Data.Functor
10import Data.Bifunctor
11import Data.List
13import System.Exit
14import System.Environment
16import Prelude
18matchPrefixes :: [String] -> (String -> Bool)
19matchPrefixes [] = const True
20matchPrefixes args = \name -> any (`isPrefixOf` name) args
23main :: IO ()
24main = do
25 args <- getArgs
27 case args of
28 ["--list"] -> mapM_ putStrLn (fst <$> allTests) >> exitWith (ExitFailure 1)
29 _ -> case filter (matchPrefixes args . fst) allTests of
30 [] -> putStrLn "filter did not match any tests" >> exitWith (ExitFailure 1)
31 tests -> runTests tests
33 where
34 allTests = concat
35 [ makeGroup "micro" Micro.testCases
36 , makeGroup "subscribing (100,40)" (Focused.subscribing 100 40)
37 , makeGroup "firing 1000" (Focused.firing 1000)
38 , makeGroup "merge 100" (Focused.merging 100)
39 , makeGroup "fan 50" (Focused.fans 50)
40 ]
42 makeGroup name tests = first (\test -> intercalate "/" [name, test]) <$> tests