1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00
semantic/semantic-typescript/test/PreciseTest.hs
Patrick Thomson 0754ff36c7 do them all
2020-07-01 21:47:30 -04:00

31 lines
936 B
Haskell

{-# LANGUAGE CPP, DisambiguateRecordFields, OverloadedStrings, TypeApplications, ImplicitParams #-}
{-# OPTIONS_GHC -Wno-unused-imports #-}
module Main (main) where
import TreeSitter.TypeScript
import AST.TestHelpers
import AST.Unmarshal
import qualified Language.TypeScript.AST as Ts
import qualified System.Path as Path
import Test.Tasty
import qualified System.Path.Fixture as Fixture
main :: IO ()
main = do
#if BAZEL_BUILD
rf <- Fixture.create
let ?project = Path.relDir "external/tree-sitter-typescript"
?runfiles = rf
let dirs = Fixture.absRelDir "typescript/corpus"
#else
dirs <- Path.absRel <$> Ts.getTestCorpusDir
#endif
readCorpusFiles' dirs
>>= traverse (testCorpus parse)
>>= defaultMain . tests
where parse = parseByteString @Ts.Program @() tree_sitter_typescript
tests :: [TestTree] -> TestTree
tests = testGroup "tree-sitter-typescript corpus tests"