1
1
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:
Josh Vera 2020-05-27 15:58:55 -04:00 committed by GitHub
commit 09b5e4964c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -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

View File

@ -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"