on 7bb5ff4 help sign in
reflex/test/Reflex/Test/RunAll.hs
43 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.Bifunctor
10import Data.List
12import System.Exit
13import System.Environment
15import Prelude
17matchPrefixes :: [String] -> (String -> Bool)
18matchPrefixes [] = const True
19matchPrefixes args = \name -> any (`isPrefixOf` name) args
22main :: IO ()
23main = do
24 args <- getArgs
26 case args of
27 ["--list"] -> mapM_ putStrLn (fst <$> allTests) >> exitWith (ExitFailure 1)
28 _ -> case filter (matchPrefixes args . fst) allTests of
29 [] -> putStrLn "filter did not match any tests" >> exitWith (ExitFailure 1)
30 tests -> runTests tests
32 where
33 allTests = concat
34 [ makeGroup "micro" Micro.testCases
35 , makeGroup "subscribing (100,40)" (Focused.subscribing 100 40)
36 , makeGroup "firing 1000" (Focused.firing 1000)
37 , makeGroup "merge 100" (Focused.merging 100)
38 , makeGroup "fan 50" (Focused.fans 50)
39 ]
41 makeGroup name tests = first (\test -> intercalate "/" [name, test]) <$> tests