Runtime contract guard kernel
This commit is contained in:
@@ -58,7 +58,7 @@ allTestLibsEnv = unsafePerformIO $ do
|
||||
io <- evaluateFile "./lib/io.tri"
|
||||
sock <- evaluateFile "./lib/socket.tri"
|
||||
intensional <- evaluateFile "./lib/intensionalContracts.tri"
|
||||
pure (Map.unions [base, bytes, bin, http, arbor, io, sock, intensional])
|
||||
pure (injectKernel (Map.unions [base, bytes, bin, http, arbor, io, sock, intensional]))
|
||||
{-# NOINLINE allTestLibsEnv #-}
|
||||
|
||||
tests :: TestTree
|
||||
@@ -1261,7 +1261,7 @@ contractsTests = testGroup "Contracts library tests"
|
||||
, "main = boom"
|
||||
]
|
||||
env = evalTricu allTestLibsEnv (parseTricu input)
|
||||
result env @?= ofString "boom"
|
||||
decodeResult (result env) @?= "[t, \"boom\"]"
|
||||
|
||||
, testCase "@ argument annotation passes" $ do
|
||||
let input = unlines
|
||||
@@ -1277,7 +1277,7 @@ contractsTests = testGroup "Contracts library tests"
|
||||
, "main = idNat 5"
|
||||
]
|
||||
env = evalTricu allTestLibsEnv (parseTricu input)
|
||||
result env @?= ofString "bad"
|
||||
decodeResult (result env) @?= "[t, \"bad\"]"
|
||||
]
|
||||
|
||||
arithmetic :: TestTree
|
||||
@@ -2023,7 +2023,7 @@ contentStoreTests = testGroup "Content Store Tests"
|
||||
result env @?= ofNumber 5
|
||||
writeFile mainPath "!import \"util\" Util\n\nmain = Util.badId 5\n"
|
||||
envFail <- evaluateFileWithStore (Just store) mainPath
|
||||
decodeResult (result envFail) @?= "\"nope\""
|
||||
decodeResult (result envFail) @?= "[t, \"nope\"]"
|
||||
|
||||
, testCase "Module imports: resolve manifest exports from store" $
|
||||
withSystemTempDirectory "tricu-module-import" $ \dir -> do
|
||||
|
||||
Reference in New Issue
Block a user