1
1
mirror of https://github.com/github/semantic.git synced 2025-01-07 16:07:28 +03:00

fix semantic-rust tests on cabal

This commit is contained in:
Patrick Thomson 2020-07-01 21:03:22 -04:00
parent 318124a9f1
commit 899f10bbbc
2 changed files with 19 additions and 5 deletions

View File

@ -48,6 +48,8 @@ common haskell
-Wno-star-is-type
if (impl(ghc >= 8.8))
ghc-options: -Wno-missing-deriving-strategies
cpp-options:
-DBAZEL_BUILD=0
library
import: haskell

View File

@ -1,20 +1,32 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE ImplicitParams #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}
module Main (main) where
import AST.TestHelpers
import AST.Unmarshal (parseByteString)
import Language.Rust.Grammar
import qualified Language.Rust.AST as Rust
import qualified System.Path as Path
import Test.Tasty
import Control.Monad (liftM)
main :: IO ()
main
= Path.absDir <$> Rust.getTestCorpusDir
>>= excludeMacrosCorpus . readCorpusFiles'
>>= traverse (testCorpus parse)
>>= defaultMain . tests
main = do
#if BAZEL_BUILD
rf <- Fixture.create
let ?project = Path.relDir "external/tree-sitter-python"
?runfiles = rf
let dirs = Fixture.absRelDir "test/corpus"
#else
dirs <- Path.absRel <$> Rust.getTestCorpusDir
#endif
excludeMacrosCorpus (readCorpusFiles' dirs)
>>= traverse (testCorpus parse)
>>= defaultMain . tests
where
parse = parseByteString @Rust.SourceFile @() tree_sitter_rust
excludeMacrosCorpus l = liftM (filter (f "expressions") ) l