book icon indicating copy to clipboard operation
book copied to clipboard

Update testing functions examples with best practices

Open urataps opened this issue 2 years ago • 1 comments

Hello forgers,

I spotted an inconsistency in the documentation. The Forge Guide part of the book is not up to date with the testing best practices described in the Tutorials chapter.

More specifically, the provided test functions examples do not comply with the following pattern, also outlined here:

  • test_Description for standard tests.
  • testFuzz_Description for fuzz tests.
  • test_Revert[If|When]_Condition for tests expecting a revert.
  • testFork_Description for tests that fork from a network.
  • testForkFuzz_Revert[If|When]_Condition for a fuzz test that forks and expects a revert.

This can lead newcomers on an unscrupulous path of writing unclear tests and thus have bad coverage.

To fix this, we would need to update the solidity contracts from the projects folder.

I can open a PR for dis.

urataps avatar Mar 09 '23 10:03 urataps

Closed by #843? cc @mattsse

mds1 avatar Mar 09 '23 21:03 mds1