mirror of
https://github.com/github/semantic.git
synced 2024-11-23 08:27:56 +03:00
Merge pull request #555 from p-alik/issue-553
little improvement of AST.Test.exampleParser
This commit is contained in:
commit
09b5e4964c
@ -10,6 +10,7 @@ module AST.Test
|
||||
import Control.Applicative
|
||||
import Control.Monad
|
||||
import Data.Attoparsec.ByteString.Char8
|
||||
import Data.Attoparsec.ByteString.Char8 as Attoparsec
|
||||
import Data.ByteString (ByteString, readFile)
|
||||
import Data.ByteString.Char8 (pack, unpack)
|
||||
import Data.Either
|
||||
@ -76,7 +77,7 @@ exampleParser = do
|
||||
code <- manyTill anyChar outputSepParser
|
||||
_out <- manyTill anyChar (choice [endOfInput, char '=' $> ()])
|
||||
pure (CorpusExample name (pack code))
|
||||
where outputSepParser = choice [string "\n---\n", string "\r\n---\r\n"]
|
||||
where outputSepParser = (Attoparsec.take 3) *> (Attoparsec.char '-') *> endOfLine
|
||||
|
||||
exampleNameParser :: Parser String
|
||||
exampleNameParser = do
|
||||
|
@ -18,8 +18,8 @@ main
|
||||
>>= defaultMain . tests
|
||||
where
|
||||
parse = parseByteString @Rust.SourceFile @() tree_sitter_rust
|
||||
excludeMacrosCorpus l = liftM (filter (f "expressions") ) $ liftM (filter (f "macros") ) l
|
||||
excludeMacrosCorpus l = liftM (filter (f "expressions") ) l
|
||||
where f p bn = p /= (Path.toString . Path.takeBaseName) bn
|
||||
|
||||
tests :: [TestTree] -> TestTree
|
||||
tests = testGroup "tree-sitter-rust corpus tests"
|
||||
tests = testGroup "tree-sitter-rust corpus tests"
|
||||
|
Loading…
Reference in New Issue
Block a user