Skip to content

Commit

Permalink
missing fixture modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
merklejerk committed May 6, 2023
1 parent c648beb commit fe7edc4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ out = 'out'
libs = ['lib']
optimizer = false
optimizer_runs = 200
ignored_error_codes=[3628, 5159]
ignored_error_codes=[3628, 5159, 1878]

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
1 change: 0 additions & 1 deletion src/PuzzleBoxSolution.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import "./PuzzleBox.sol";
Expand Down
6 changes: 4 additions & 2 deletions test/PuzzleBox.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ contract PuzzleBoxFixture is Test {
PuzzleBox _puzzle;
PuzzleBoxSolution _solution;

function setUp() external {
// Use a modifier instead of setUp() to keep it all in one tx.
modifier initEnv() {
_puzzle = _factory.createPuzzleBox{value: 1337}();
_solution = PuzzleBoxSolution(address(new SolutionContainer(type(PuzzleBoxSolution).runtimeCode)));
_;
}

function test_win() external {
function test_win() external initEnv {
// Uncomment to verify a complete solution.
// vm.expectEmit(false, false, false, false, address(_puzzle));
// emit Open(address(0));
Expand Down

0 comments on commit fe7edc4

Please sign in to comment.