Skip to content

Commit

Permalink
Merge pull request #13 from kadena-io/jose/obj-tables
Browse files Browse the repository at this point in the history
Objects + Db
  • Loading branch information
jmcardon authored Oct 17, 2023
2 parents da61e66 + 41b75d5 commit 4199b27
Show file tree
Hide file tree
Showing 48 changed files with 6,736 additions and 2,606 deletions.
11 changes: 10 additions & 1 deletion pact-core-tests/Pact/Core/Test/LexerParserTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ parsedNameGen = Gen.choice [qn, bn]
mn <- moduleNameGen
let qname = QualifiedName name mn
pure (QN qname)
parsedTyNameGen :: Gen ParsedTyName
parsedTyNameGen = Gen.choice [qn, bn]
where
bn = TBN . BareName <$> identGen
qn = do
name <- identGen
mn <- moduleNameGen
let qname = QualifiedName name mn
pure (TQN qname)

moduleNameGen :: Gen ModuleName
moduleNameGen = do
Expand Down Expand Up @@ -175,7 +184,7 @@ exprGen = Gen.recursive Gen.choice
,Lisp.TyModRef <$> moduleNameGen
,pure Lisp.TyGuard
,pure Lisp.TyKeyset
,Lisp.TyObject <$> parsedNameGen
,Lisp.TyObject <$> parsedTyNameGen
,pure Lisp.TyTime
,pure Lisp.TyPolyObject]

Expand Down
17 changes: 12 additions & 5 deletions pact-core-tests/Pact/Core/Test/ReplTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Test.Tasty.HUnit

import Control.Monad(when)
import Data.IORef
import Data.Default
import Data.ByteString(ByteString)
import Data.Foldable(traverse_)
import Data.Text.Encoding(decodeUtf8)
Expand All @@ -17,13 +18,14 @@ import qualified Data.ByteString as B
import Pact.Core.Gas
import Pact.Core.Literal
import Pact.Core.Persistence

import Pact.Core.IR.Eval.Runtime
import Pact.Core.Interpreter

import Pact.Core.Repl.Utils
import Pact.Core.Compile
import Pact.Core.Repl.Compile
import Pact.Core.PactValue
import Pact.Core.Environment
import Pact.Core.Hash
import Pact.Core.Errors (PactError(..), EvalError (..))

tests :: IO TestTree
Expand All @@ -47,14 +49,19 @@ runReplTest file src = do
gasRef <- newIORef (Gas 0)
gasLog <- newIORef Nothing
pdb <- mockPactDb
let ee = EvalEnv mempty pdb (EnvData mempty) (Hash "default") def Transactional mempty
let rstate = ReplState
{ _replFlags = mempty
, _replLoaded = mempty
, _replEvalState = def
, _replPactDb = pdb
, _replGas = gasRef
, _replEvalLog = gasLog }
, _replEvalLog = gasLog
, _replCurrSource = SourceCode mempty
, _replEvalEnv = ee
, _replTx = Nothing
}
stateRef <- newIORef rstate
runReplT stateRef (interpretReplProgram src) >>= \case
runReplT stateRef (interpretReplProgram (SourceCode src)) >>= \case
Left e -> let
rendered = replError (ReplSource (T.pack file) (decodeUtf8 src)) e
in assertFailure (T.unpack rendered)
Expand Down
8 changes: 4 additions & 4 deletions pact-core-tests/PactCoreTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ module Main where

import Test.Tasty

-- import qualified Pact.Core.Test.ReplTests as ReplTests
import qualified Pact.Core.Test.ReplTests as ReplTests
import qualified Pact.Core.Test.LexerParserTests as LexerParserTests
import qualified Pact.Core.Test.LexerTests as LexerTests

main :: IO ()
main = do
-- replTests <- ReplTests.tests
replTests <- ReplTests.tests
defaultMain $ testGroup "pactTests"
-- [ replTests
[ LexerTests.tests
[ replTests
, LexerTests.tests
, LexerParserTests.tests
]
Loading

0 comments on commit 4199b27

Please sign in to comment.