added test entree
Something is wrong. It does not work.
This commit is contained in:
parent
c96ac583db
commit
54e95364ea
2 changed files with 96 additions and 12 deletions
|
|
@ -13,6 +13,8 @@ module Spec.Util (
|
|||
policyFailsWith,
|
||||
validatorSucceedsWith,
|
||||
validatorFailsWith,
|
||||
effectSucceedsWith,
|
||||
effectFailsWith,
|
||||
|
||||
-- * Plutus-land utils
|
||||
datumHash,
|
||||
|
|
@ -129,6 +131,45 @@ validatorFailsWith tag policy datum redeemer scriptContext =
|
|||
# pconstant scriptContext
|
||||
)
|
||||
|
||||
|
||||
-- | Check that a validator script succeeds, given a name and arguments.
|
||||
effectSucceedsWith ::
|
||||
( PLift datum
|
||||
, PlutusTx.ToData (PLifted datum)
|
||||
) =>
|
||||
String ->
|
||||
ClosedTerm PValidator ->
|
||||
PLifted datum ->
|
||||
ScriptContext ->
|
||||
TestTree
|
||||
effectSucceedsWith tag eff datum scriptContext =
|
||||
scriptSucceeds tag $
|
||||
compile
|
||||
( eff
|
||||
# pforgetData (pconstantData datum)
|
||||
# pforgetData (pconstantData ())
|
||||
# pconstant scriptContext
|
||||
)
|
||||
|
||||
-- | Check that a validator script fails, given a name and arguments.
|
||||
effectFailsWith ::
|
||||
( PLift datum
|
||||
, PlutusTx.ToData (PLifted datum)
|
||||
) =>
|
||||
String ->
|
||||
ClosedTerm PValidator ->
|
||||
PLifted datum ->
|
||||
ScriptContext ->
|
||||
TestTree
|
||||
effectFailsWith tag eff datum scriptContext =
|
||||
scriptFails tag $
|
||||
compile
|
||||
( eff
|
||||
# pforgetData (pconstantData datum)
|
||||
# pforgetData (pconstantData ())
|
||||
# pconstant scriptContext
|
||||
)
|
||||
|
||||
-- | Check that an arbitrary script doesn't error when evaluated, given a name.
|
||||
scriptSucceeds :: String -> Script -> TestTree
|
||||
scriptSucceeds name script = testCase name $ do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue