Skip to content

Commit

Permalink
defpact impl static tests
Browse files Browse the repository at this point in the history
  • Loading branch information
0xd34df00d committed Dec 18, 2023
1 parent 96ce13b commit 01e13eb
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions pact-core-tests/Pact/Core/Test/StaticErrorTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,15 @@ staticTests =
(defun f:integer (a b) a)
)
|])
, ("module_implements_defcap_missing", isDesugarError _NotImplemented, [text|
(interface iface
(defcap CAP:bool (a:integer))
)

(module m g (defcap g () true)
(implements iface)
)
|])
, ("module_implements_defcap_wrong_kind", isDesugarError _ImplementationError, [text|
(interface iface
(defcap CAP:bool (a:integer))
Expand Down Expand Up @@ -463,6 +472,69 @@ staticTests =
(defcap CAP:integer (a:integer) 1)
)
|])
, ("module_implements_defpact_missing", isDesugarError _NotImplemented, [text|
(interface iface
(defpact p:string (arg:string))
)

(module m g (defcap g () true)
(implements iface)
)
|])
, ("module_implements_defpact_wrong_kind", isDesugarError _ImplementationError, [text|
(interface iface
(defpact p:string (arg:string))
)

(module m g (defcap g () true)
(implements iface)
(defun p:string (arg:string) arg)
)
|])
, ("module_implements_defpact_wrong_ret_type", isDesugarError _ImplementationError, [text|
(interface iface
(defpact p:string (arg:string))
)

(module m g (defcap g () true)
(implements iface)
(defpact p:bool (arg:string)
(step "step-0"))
)
|])
, ("module_implements_defpact_wrong_arg_type", isDesugarError _ImplementationError, [text|
(interface iface
(defpact p:string (arg:string))
)

(module m g (defcap g () true)
(implements iface)
(defpact p:string (arg:bool)
(step "step-0"))
)
|])
, ("module_implements_defpact_wrong_arg_count_less", isDesugarError _ImplementationError, [text|
(interface iface
(defpact p:string (arg:string))
)

(module m g (defcap g () true)
(implements iface)
(defpact p:string ()
(step "step-0"))
)
|])
, ("module_implements_defpact_wrong_arg_count_more", isDesugarError _ImplementationError, [text|
(interface iface
(defpact p:string (arg:string))
)

(module m g (defcap g () true)
(implements iface)
(defpact p:string (arg:string b:bool)
(step "step-0"))
)
|])
]

tests :: TestTree
Expand Down

0 comments on commit 01e13eb

Please sign in to comment.