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

38 lines
898 B
Haskell

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