Skip to content

Commit

Permalink
Add tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
thealmarty committed Sep 14, 2021
1 parent 57535bf commit 5cf95a8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions plutus-tx-plugin/plutus-tx-plugin.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ test-suite plutus-tx-tests
Plugin.Functions.Spec
Plugin.Laziness.Spec
Plugin.Primitives.Spec
Plugin.Primitives.Profiling
Plugin.Typeclasses.Spec
Plugin.Typeclasses.Lib
Plugin.Lib
Expand Down
3 changes: 2 additions & 1 deletion plutus-tx-plugin/src/PlutusTx/Compiler/Expr.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import PlutusTx.Compiler.Type
import PlutusTx.Compiler.Types
import PlutusTx.Compiler.Utils
import PlutusTx.PIRTypes
import PlutusTx.Prelude (trace)
-- I feel like we shouldn't need this, we only need it to spot the special String type, which is annoying
import qualified PlutusTx.Builtins.Class as Builtins

Expand Down Expand Up @@ -408,7 +409,7 @@ hoistExpr var t =
t' <-
if coProfile profileOpts==All then do
t'' <- compileExpr t
return $ Builtins.trace "entering x" (\() -> Builtins.trace "exiting x" t'') ()
return $ trace "entering x" (\() -> trace "exiting x" t'') ()
else compileExpr t
-- TODO add Some option

Expand Down
2 changes: 1 addition & 1 deletion plutus-tx-plugin/test/Plugin/Basic/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ monoId = plc (Proxy @"monoId") (\(x :: Integer) -> x)
monoK :: CompiledCode (Integer -> Integer -> Integer)
monoK = plc (Proxy @"monoK") (\(i :: Integer) -> \(j :: Integer) -> i)

-- GHC acutually turns this into a lambda for us, try and make one that stays a let
-- GHC actually turns this into a lambda for us, try and make one that stays a let
letFun :: CompiledCode (Integer -> Integer -> Bool)
letFun = plc (Proxy @"letFun") (\(x::Integer) (y::Integer) -> let f z = Builtins.equalsInteger x z in f y)

Expand Down
2 changes: 2 additions & 0 deletions plutus-tx-plugin/test/Plugin/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ import Plugin.Data.Spec
import Plugin.Errors.Spec
import Plugin.Functions.Spec
import Plugin.Laziness.Spec
import qualified Plugin.Primitives.Profiling as Profile
import Plugin.Primitives.Spec
import Plugin.Typeclasses.Spec

tests :: TestNested
tests = testNested "Plugin" [
basic
, primitives
, Profile.primitives
, datat
, functions
, laziness
Expand Down

0 comments on commit 5cf95a8

Please sign in to comment.