Skip to content
Permalink
Browse files

Add a couple of tests to illustrate the behaviour of errors inside ty…

…pe abstractions
  • Loading branch information
michaelpj committed Jan 14, 2020
1 parent d51dc23 commit 4b89d10731a08c8fc65323cfbc8e1e36c810f544
@@ -92,6 +92,11 @@ smallNatList = metaListToList nat nats where
nats = map metaIntegerToNat [1,2,3]
nat = _recursiveType natData

polyError :: Term TyName Name ()
polyError = runQuote $ do
a <- freshTyName () "a"
pure $ TyAbs () a (Type ()) $ Error () (TyVar () a)

goldenVsPretty :: PrettyPlc a => String -> ExceptT BSL.ByteString IO a -> TestTree
goldenVsPretty name value =
goldenVsString name ("test/Evaluation/Golden/" ++ name ++ ".plc.golden") $
@@ -104,4 +109,6 @@ test_golden = testGroup "golden"
, goldenVsPretty "even3" . pure . evaluateCk $ Apply () even $ metaIntegerToNat 3
, goldenVsPretty "evenList" . pure . evaluateCk $
Apply () natSum $ Apply () evenList smallNatList
, goldenVsPretty "polyError" . pure . evaluateCk $ polyError
, goldenVsPretty "polyErrorInst" . pure . evaluateCk $ TyInst () polyError (TyBuiltin () TyInteger)
]
@@ -0,0 +1 @@
(abs a_0 (type) (error a_0))
@@ -0,0 +1 @@
Failure

0 comments on commit 4b89d10

Please sign in to comment.
You can’t perform that action at this time.