Skip to content

Commit

Permalink
TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
msooseth committed Oct 28, 2024
1 parent dbb014f commit c0cca47
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/EVM.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1700,6 +1700,9 @@ cheat gas (inOffset, inSize) (outOffset, outSize) xs = do

type CheatAction t s = Expr Buf -> EVM t s ()

-- TODO add: assertTrue etc. from: https://github.com/foundry-rs/forge-std/blob/master/src/StdAssertions.sol
-- implement: assertTrue.. see list: https://github.com/foundry-rs/foundry/blob/master/crates/cheatcodes/spec/src/vm.rs#L843
-- TODO: make this a separate file like CheatCodes.hs
cheatActions :: VMOps t => Map FunctionSelector (CheatAction t s)
cheatActions = Map.fromList
[ action "ffi(string[])" $
Expand Down
9 changes: 9 additions & 0 deletions src/EVM/UnitTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ symRun opts@UnitTestOptions{..} vm (Sig testName types) = do
False -> \(_, post) -> case post of
Success _ _ _ store -> PNeg (failed store)
Failure _ _ (Revert msg) -> case msg of
-- TODO: add line here with "asssert failed" as a prefix, see
-- https://github.com/foundry-rs/foundry/blob/master/crates/cheatcodes/src/test/assert.rs#L183C50-L183C66
ConcreteBuf b -> PBool $ b /= panicMsg 0x01
b -> b ./= ConcreteBuf (panicMsg 0x01)
Failure _ _ _ -> PBool True
Expand Down Expand Up @@ -287,6 +289,13 @@ execSymTest UnitTestOptions{ .. } method cd = do
-- Try running the test method
runExpr

-- TODO see: https://github.com/foundry-rs/foundry/blob/master/crates/cheatcodes/src/test/assert.rs#L189
-- see: https://github.com/foundry-rs/foundry/blob/master/crates/cheatcodes/src/inspector.rs#L757
-- Seems like all failures contain a "assertion failed", see line:
-- https://github.com/foundry-rs/foundry/blob/master/crates/cheatcodes/src/test/assert.rs#L183C50-L183C66
-- We'll need to initially at least:
-- - check "assertion failed" in the revert message (we check for Panic currently NH...)
-- -
checkSymFailures :: VMOps t => UnitTestOptions RealWorld -> Stepper t RealWorld (VM t RealWorld)
checkSymFailures UnitTestOptions { .. } = do
-- Ask whether any assertions failed
Expand Down

0 comments on commit c0cca47

Please sign in to comment.