mirror of
https://github.com/unisonweb/unison.git
synced 2024-11-14 07:51:12 +03:00
Add test for the EmptyBlock parser error
This commit is contained in:
parent
cdcdf92374
commit
4d18134a30
@ -55,7 +55,7 @@ module Unison.Test.FileParser where
|
||||
|
||||
test :: Test ()
|
||||
test = scope "fileparser" . tests $
|
||||
[test1, emptyWatchTest, signatureNeedsAccompanyingBodyTest]
|
||||
[test1, emptyWatchTest, signatureNeedsAccompanyingBodyTest, emptyBlockTest]
|
||||
|
||||
expectFileParseFailure :: String -> (P.Error Symbol -> Test ()) -> Test ()
|
||||
expectFileParseFailure s expectation = scope s $ do
|
||||
@ -87,6 +87,15 @@ module Unison.Test.FileParser where
|
||||
P.SignatureNeedsAccompanyingBody _ -> ok
|
||||
_ -> crash "Error wasn't SignatureNeedsAccompanyingBody"
|
||||
|
||||
emptyBlockTest :: Test ()
|
||||
emptyBlockTest = scope "emptyBlockTest" $
|
||||
expectFileParseFailure (unlines ["f a =", "", "> 1 + 1"]) expectation
|
||||
where
|
||||
expectation :: Var e => P.Error e -> Test ()
|
||||
expectation e = case e of
|
||||
P.EmptyBlock _ -> ok
|
||||
_ -> crash "Error wasn't EmptyBlock"
|
||||
|
||||
builtins :: Names
|
||||
builtins = Names.fromTerms
|
||||
[ ("Pair" , Referent.Con (R.Builtin "Pair") 0)
|
||||
|
Loading…
Reference in New Issue
Block a user