1
1
mirror of https://github.com/github/semantic.git synced 2024-12-27 00:44:57 +03:00
semantic/test/Spec.hs

96 lines
3.8 KiB
Haskell
Raw Normal View History

{-# LANGUAGE ImplicitParams #-}
module Main (allTests, legacySpecs, main, tests) where
2016-01-05 19:27:37 +03:00
2018-03-13 21:14:55 +03:00
import qualified Analysis.Go.Spec
import qualified Analysis.PHP.Spec
import qualified Analysis.Python.Spec
2018-03-14 02:19:26 +03:00
import qualified Analysis.Ruby.Spec
2018-03-10 03:24:32 +03:00
import qualified Analysis.TypeScript.Spec
2017-11-27 21:47:04 +03:00
import qualified Assigning.Assignment.Spec
2018-05-07 21:21:05 +03:00
import qualified Control.Abstract.Evaluator.Spec
2017-11-27 21:59:44 +03:00
import qualified Data.Diff.Spec
2018-10-31 20:19:43 +03:00
import qualified Data.Abstract.Name.Spec
import qualified Data.Abstract.Path.Spec
import qualified Data.Functor.Classes.Generic.Spec
2018-10-31 19:20:38 +03:00
import qualified Data.Graph.Spec
2019-08-16 01:48:17 +03:00
import qualified Data.Language.Spec
import qualified Data.Scientific.Spec
2018-10-31 22:47:30 +03:00
import qualified Data.Semigroup.App.Spec
2017-11-27 22:02:03 +03:00
import qualified Data.Term.Spec
2017-11-27 21:48:43 +03:00
import qualified Diffing.Algorithm.RWS.Spec
2017-11-27 21:51:05 +03:00
import qualified Diffing.Algorithm.SES.Spec
2017-11-27 22:03:45 +03:00
import qualified Diffing.Interpreter.Spec
2018-07-16 18:07:40 +03:00
import qualified Graphing.Calls.Spec
2017-11-27 22:06:12 +03:00
import qualified Integration.Spec
import qualified Numeric.Spec
import qualified Parsing.Spec
2017-11-27 22:04:58 +03:00
import qualified Rendering.TOC.Spec
2018-11-02 23:55:30 +03:00
import qualified Tags.Spec
2017-11-27 22:00:53 +03:00
import qualified Semantic.Spec
2017-11-27 21:57:25 +03:00
import qualified Semantic.CLI.Spec
2017-11-27 21:52:48 +03:00
import qualified Semantic.IO.Spec
2017-11-27 21:58:23 +03:00
import qualified Semantic.Stat.Spec
2019-02-02 02:04:23 +03:00
import Semantic.Config (defaultOptions, optionsLogLevel)
import Semantic.Task (withOptions, TaskSession(..))
2016-01-05 19:27:37 +03:00
import Test.Hspec
import Test.Tasty as Tasty
import Test.Tasty.Hspec as Tasty
tests :: (?session :: TaskSession) => [TestTree]
tests =
2019-09-26 00:09:23 +03:00
[ Data.Language.Spec.testTree
, Data.Scientific.Spec.testTree
, Data.Semigroup.App.Spec.testTree
2019-09-26 00:09:23 +03:00
, Integration.Spec.testTree
, Numeric.Spec.testTree
, Semantic.CLI.Spec.testTree
, Semantic.Stat.Spec.testTree
]
-- We can't bring this out of the IO monad until we divest
-- from hspec, since testSpec operates in IO.
allTests :: (?session :: TaskSession) => IO TestTree
allTests = do
asTastySpecs <- Tasty.testSpecs legacySpecs
let allSpecs = tests <> asTastySpecs
pure . Tasty.localOption Tasty.Success $ testGroup "semantic" allSpecs
-- If you're writing new test modules, please don't add to this
-- stanza: it is only there to prevent massive rewrites, and is
-- converted into a Tasty TestTree in 'main'. (Quoth the tasty-hspec
-- documentation: "hspec and tasty serve similar purposes; consider
2019-06-12 20:27:34 +03:00
-- using one or the other.") Instead, create a new TestTree value
-- in your spec module and add it to the above 'tests' list.
legacySpecs :: (?session :: TaskSession) => Spec
legacySpecs = parallel $ do
2019-06-20 00:22:09 +03:00
describe "Analysis.Go" Analysis.Go.Spec.spec
describe "Analysis.PHP" Analysis.PHP.Spec.spec
describe "Analysis.Python" Analysis.Python.Spec.spec
describe "Analysis.Ruby" Analysis.Ruby.Spec.spec
describe "Analysis.TypeScript" Analysis.TypeScript.Spec.spec
describe "Assigning.Assignment" Assigning.Assignment.Spec.spec
describe "Control.Abstract.Evaluator" Control.Abstract.Evaluator.Spec.spec
describe "Data.Diff" Data.Diff.Spec.spec
describe "Data.Graph" Data.Graph.Spec.spec
describe "Data.Abstract.Path" Data.Abstract.Path.Spec.spec
describe "Data.Abstract.Name" Data.Abstract.Name.Spec.spec
describe "Data.Functor.Classes.Generic" Data.Functor.Classes.Generic.Spec.spec
describe "Data.Term" Data.Term.Spec.spec
describe "Diffing.Algorithm.RWS" Diffing.Algorithm.RWS.Spec.spec
describe "Diffing.Algorithm.SES" Diffing.Algorithm.SES.Spec.spec
describe "Diffing.Interpreter" Diffing.Interpreter.Spec.spec
describe "Graphing.Calls" Graphing.Calls.Spec.spec
describe "Rendering.TOC" Rendering.TOC.Spec.spec
2019-10-08 23:30:56 +03:00
describe "Tags.Spec" Tags.Spec.spec
2019-06-20 00:22:09 +03:00
describe "Semantic" Semantic.Spec.spec
describe "Semantic.IO" Semantic.IO.Spec.spec
describe "Parsing" Parsing.Spec.spec
2016-01-05 19:27:37 +03:00
main :: IO ()
main = do
withOptions defaultOptions { optionsLogLevel = Nothing } $ \ config logger statter ->
let ?session = TaskSession config "-" False logger statter
in allTests >>= defaultMain