Skip to content

Commit

Permalink
fix(forge): clear console.logs between test cases (gakonst#405)
Browse files Browse the repository at this point in the history
Co-authored-by: Tim Lancina <tlancina@users.noreply.github.com>
  • Loading branch information
tlancina and tlancina authored Jan 8, 2022
1 parent d586f32 commit 18a0c27
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions evm-adapters/src/sputnik/cheatcodes/cheatcode_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ impl<'a, 'b, B: Backend, P: PrecompileSet> SputnikExecutor<CheatcodeStackState<'
}

fn clear_logs(&mut self) {
self.console_logs.clear();
self.state_mut().substate.logs_mut().clear()
}

Expand Down Expand Up @@ -1439,6 +1440,10 @@ mod tests {
.map(ToString::to_string)
.collect::<Vec<_>>();
assert_eq!(logs, expected);

let (_, _, _, logs) =
evm.call::<(), _, _>(Address::zero(), addr, "test_log()", (), 0.into()).unwrap();
assert_eq!(logs, expected);
}

#[test]
Expand Down

0 comments on commit 18a0c27

Please sign in to comment.