diff --git a/src/EVM.hs b/src/EVM.hs index f1873fb52..4f511ae15 100644 --- a/src/EVM.hs +++ b/src/EVM.hs @@ -1683,6 +1683,9 @@ cheat (inOffset, inSize) (outOffset, outSize) = do type CheatAction t s = Expr EWord -> Expr EWord -> 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[])" $ diff --git a/src/EVM/UnitTest.hs b/src/EVM/UnitTest.hs index 6d7c35283..939b0e983 100644 --- a/src/EVM/UnitTest.hs +++ b/src/EVM/UnitTest.hs @@ -209,6 +209,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 @@ -284,6 +286,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