Skip to content

Commit

Permalink
chore: update CounterTemplate.t.sol to adhere to best practices (#5619
Browse files Browse the repository at this point in the history
)

* chore: update test template to adhere to best practices

* fix: update fixtures

* fix: update fixture gas

* reorder

---------

Co-authored-by: Enrique Ortiz <[email protected]>
  • Loading branch information
Sabnock01 and Evalir authored Aug 13, 2023
1 parent 3158028 commit dffdfde
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions crates/cli/assets/CounterTemplate.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ contract CounterTest is Test {
counter.setNumber(0);
}

function testIncrement() public {
function test_Increment() public {
counter.increment();
assertEq(counter.number(), 1);
}

function testSetNumber(uint256 x) public {
function testFuzz_SetNumber(uint256 x) public {
counter.setNumber(x);
assertEq(counter.number(), x);
}
Expand Down
4 changes: 2 additions & 2 deletions crates/cli/tests/fixtures/can_test_repeatedly.stdout
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
No files changed, compilation skipped

Running 2 tests for test/Counter.t.sol:CounterTest
[PASS] testIncrement() (gas: 28334)
[PASS] testSetNumber(uint256) (runs: 256, μ: 26521, ~: 28387)
[PASS] testFuzz_SetNumber(uint256) (runs: 256, μ: 26521, ~: 28387)
[PASS] test_Increment() (gas: 28357)
Test result: ok. 2 passed; 0 failed; 0 skipped; finished in 9.42ms
Ran 1 test suites: 2 tests passed, 0 failed, 0 skipped (2 total tests)
2 changes: 1 addition & 1 deletion crates/config/src/inline/natspec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl NatSpec {

/// Returns a string describing the natspec
/// context, for debugging purposes 🐞
/// i.e. `test/Counter.t.sol:CounterTest:testSetNumber`
/// i.e. `test/Counter.t.sol:CounterTest:testFuzz_SetNumber`
pub fn debug_context(&self) -> String {
format!("{}:{}", self.contract, self.function)
}
Expand Down

0 comments on commit dffdfde

Please sign in to comment.