-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes issue #257
- Loading branch information
Showing
12 changed files
with
175 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
syntax = "proto3"; | ||
package TestProtoEmptyField; | ||
|
||
enum EnumWithEmptyField { | ||
enum_foo = 0; | ||
; | ||
enum_bar = 1; | ||
} | ||
|
||
message MessageWithEmptyField { | ||
uint32 foo = 1; | ||
; | ||
uint32 bar = 2; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
module Test.Proto.Parse (testTree) where | ||
|
||
import Hedgehog (property, (===)) | ||
|
||
import Proto3.Suite.DotProto.Parsing qualified as Proto3 | ||
import Proto3.Suite.DotProto.Rendering () | ||
|
||
import Test.Proto.Parse.Core (runParseTest) | ||
import Test.Tasty (TestTree, testGroup) | ||
import Test.Tasty.Hedgehog (testProperty) | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
testTree :: TestTree | ||
testTree = | ||
testGroup | ||
"Test.Proto.Parse" | ||
[ testProperty "empty" $ property do | ||
runParseTest Proto3.pEmptyStmt ";" === Right () | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
module Test.Proto.Parse.Core | ||
( runParseTest | ||
, parseTrip | ||
) where | ||
|
||
import Hedgehog (PropertyT) | ||
import Hedgehog qualified as Hedgehog | ||
|
||
import Text.Parsec (ParseError) | ||
import Text.Parsec qualified as Parsec | ||
import Text.PrettyPrint (render) | ||
import Text.PrettyPrint.HughesPJClass (Pretty, pPrint) | ||
|
||
import Proto3.Suite.DotProto.Parsing (ProtoParser) | ||
import Proto3.Suite.DotProto.Parsing qualified as Proto3 | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
runParseTest :: ProtoParser a -> String -> Either ParseError a | ||
runParseTest p = Parsec.parse (Proto3.runProtoParser p) "" | ||
|
||
parseTrip :: (Eq a, Pretty a, Show a) => a -> ProtoParser a -> PropertyT IO () | ||
parseTrip x p = Hedgehog.tripping x (render . pPrint) (runParseTest p) |
Oops, something went wrong.