From 1202ea8ab5a0a186a14bccc4bbf628bca4860baf Mon Sep 17 00:00:00 2001 From: Rens Rooimans Date: Wed, 13 Nov 2024 12:29:22 +0100 Subject: [PATCH] fix naming of tests --- contracts/gas-snapshots/shared.gas-snapshot | 33 +++++++------------ .../BurnMintERC20/BurnMintERC20.approve.t.sol | 6 ++-- .../BurnMintERC20/BurnMintERC20.burn.t.sol | 10 +++--- .../BurnMintERC20.burnFrom.t.sol | 10 +++--- .../BurnMintERC20.burnFromAlias.t.sol | 10 +++--- .../BurnMintERC20.ccipGetAdmin.t.sol | 6 ++-- .../BurnMintERC20.constructor.t.sol | 4 +-- .../BurnMintERC20.grantMintAndBurnRoles.t.sol | 4 +-- .../BurnMintERC20/BurnMintERC20.mint.t.sol | 2 +- .../BurnMintERC20.supportsInterface.t.sol | 4 +-- .../BurnMintERC20.transfer.t.sol | 6 ++-- 11 files changed, 42 insertions(+), 53 deletions(-) diff --git a/contracts/gas-snapshots/shared.gas-snapshot b/contracts/gas-snapshots/shared.gas-snapshot index 53fa23695e1..fc8096cbb5d 100644 --- a/contracts/gas-snapshots/shared.gas-snapshot +++ b/contracts/gas-snapshots/shared.gas-snapshot @@ -7,28 +7,17 @@ AuthorizedCallers_applyAuthorizedCallerUpdates:test_SkipRemove_Success() (gas: 3 AuthorizedCallers_applyAuthorizedCallerUpdates:test_ZeroAddressNotAllowed_Revert() (gas: 64413) AuthorizedCallers_constructor:test_ZeroAddressNotAllowed_Revert() (gas: 64390) AuthorizedCallers_constructor:test_constructor_Success() (gas: 674931) -BurnMintERC20approve:test_approve_InvalidAddress_Reverts() (gas: 11280) -BurnMintERC20approve:test_approve_Success() (gas: 57653) -BurnMintERC20burn:test_BasicBurn_Success() (gas: 153605) -BurnMintERC20burn:test_burn_BurnFromZeroAddress_Reverts() (gas: 43836) -BurnMintERC20burn:test_burn_ExceedsBalance_Reverts() (gas: 21892) -BurnMintERC20burn:test_burn_SenderNotBurner_Reverts() (gas: 68104) -BurnMintERC20burnFrom:test_BurnFrom_Success() (gas: 58012) -BurnMintERC20burnFrom:test_burnFrom_ExceedsBalance_Reverts() (gas: 35864) -BurnMintERC20burnFrom:test_burnFrom_InsufficientAllowance_Reverts() (gas: 21858) -BurnMintERC20burnFrom:test_burnFrom_SenderNotBurner_Reverts() (gas: 68126) -BurnMintERC20burnFromAlias:test_burn_ExceedsBalance_Reverts() (gas: 35905) -BurnMintERC20burnFromAlias:test_burn_InsufficientAllowance_Reverts() (gas: 21889) -BurnMintERC20burnFromAlias:test_burn_SenderNotBurner_Reverts() (gas: 68157) -BurnMintERC20burnFromAlias:test_burn_Success() (gas: 58004) -BurnMintERC20constructor:test_Constructor_Success() (gas: 1694875) -BurnMintERC20getCCIPAdmin:test_getCCIPAdmin_Success() (gas: 10525) -BurnMintERC20getCCIPAdmin:test_setCCIPAdmin_Success() (gas: 21612) -BurnMintERC20grantMintAndBurnRoles:test_GrantMintAndBurnRoles_Success() (gas: 79120) -BurnMintERC20mint:test_mint() (gas: 101849) -BurnMintERC20supportsInterface:test_SupportsInterface_Success() (gas: 11217) -BurnMintERC20transfer:test_transfer_InvalidAddress_Reverts() (gas: 11301) -BurnMintERC20transfer:test_transfer_Success() (gas: 42316) +BurnMintERC20_approve:test_approve() (gas: 57652) +BurnMintERC20_burn:test_BasicBurn() (gas: 153607) +BurnMintERC20_burnFrom:test_BurnFrom() (gas: 57995) +BurnMintERC20_burnFromAlias:test_burn() (gas: 58039) +BurnMintERC20_constructor:test_Constructor() (gas: 1694831) +BurnMintERC20_getCCIPAdmin:test_getCCIPAdmin() (gas: 10548) +BurnMintERC20_getCCIPAdmin:test_setCCIPAdmin() (gas: 21590) +BurnMintERC20_grantMintAndBurnRoles:test_GrantMintAndBurnRoles() (gas: 79142) +BurnMintERC20_mint:test_mint() (gas: 101849) +BurnMintERC20_supportsInterface:test_SupportsInterface() (gas: 11218) +BurnMintERC20_transfer:test_transfer() (gas: 42338) BurnMintERC677_approve:testApproveSuccess() (gas: 55512) BurnMintERC677_approve:testInvalidAddressReverts() (gas: 10663) BurnMintERC677_burn:testBasicBurnSuccess() (gas: 172100) diff --git a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.approve.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.approve.t.sol index b5ff3c2184f..d328eec8436 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.approve.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.approve.t.sol @@ -4,8 +4,8 @@ pragma solidity 0.8.24; import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol"; import {BurnMintERC20} from "../../../../token/ERC20/BurnMintERC20.sol"; -contract BurnMintERC20approve is BurnMintERC20Setup { - function test_approve_Success() public { +contract BurnMintERC20_approve is BurnMintERC20Setup { + function test_approve() public { uint256 balancePre = s_burnMintERC20.balanceOf(STRANGER); uint256 sendingAmount = s_amount / 2; @@ -23,7 +23,7 @@ contract BurnMintERC20approve is BurnMintERC20Setup { // Reverts - function test_approve_InvalidAddress_Reverts() public { + function test_approve_RevertWhen_InvalidAddress() public { vm.expectRevert(abi.encodeWithSelector(BurnMintERC20.InvalidRecipient.selector, address(s_burnMintERC20))); s_burnMintERC20.approve(address(s_burnMintERC20), s_amount); diff --git a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burn.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burn.t.sol index dc60ce468ee..75fa6e73372 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burn.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burn.t.sol @@ -7,8 +7,8 @@ import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol"; import {IERC20} from "../../../../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol"; import {Strings} from "../../../../../vendor/openzeppelin-solidity/v4.8.3/contracts/utils/Strings.sol"; -contract BurnMintERC20burn is BurnMintERC20Setup { - function test_BasicBurn_Success() public { +contract BurnMintERC20_burn is BurnMintERC20Setup { + function test_BasicBurn() public { s_burnMintERC20.grantRole(s_burnMintERC20.BURNER_ROLE(), OWNER); deal(address(s_burnMintERC20), OWNER, s_amount); @@ -22,7 +22,7 @@ contract BurnMintERC20burn is BurnMintERC20Setup { // Revert - function test_burn_SenderNotBurner_Reverts() public { + function test_burn_RevertWhen_SenderNotBurner() public { // OZ Access Control v4.8.3 inherited by BurnMintERC20 does not use custom errors, but the revert message is still useful // and should be checked vm.expectRevert( @@ -37,7 +37,7 @@ contract BurnMintERC20burn is BurnMintERC20Setup { s_burnMintERC20.burnFrom(STRANGER, s_amount); } - function test_burn_ExceedsBalance_Reverts() public { + function test_burn_RevertWhen_ExceedsBalance() public { changePrank(s_mockPool); vm.expectRevert("ERC20: burn amount exceeds balance"); @@ -45,7 +45,7 @@ contract BurnMintERC20burn is BurnMintERC20Setup { s_burnMintERC20.burn(s_amount * 2); } - function test_burn_BurnFromZeroAddress_Reverts() public { + function test_burn_RevertWhen_BurnFromZeroAddress() public { s_burnMintERC20.grantRole(s_burnMintERC20.BURNER_ROLE(), address(0)); changePrank(address(0)); diff --git a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burnFrom.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burnFrom.t.sol index afd5c432824..b32d42a86e5 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burnFrom.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burnFrom.t.sol @@ -6,12 +6,12 @@ import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol"; import {Strings} from "../../../../../vendor/openzeppelin-solidity/v4.8.3/contracts/utils/Strings.sol"; -contract BurnMintERC20burnFrom is BurnMintERC20Setup { +contract BurnMintERC20_burnFrom is BurnMintERC20Setup { function setUp() public virtual override { BurnMintERC20Setup.setUp(); } - function test_BurnFrom_Success() public { + function test_BurnFrom() public { s_burnMintERC20.approve(s_mockPool, s_amount); changePrank(s_mockPool); @@ -23,7 +23,7 @@ contract BurnMintERC20burnFrom is BurnMintERC20Setup { // Reverts - function test_burnFrom_SenderNotBurner_Reverts() public { + function test_burnFrom_RevertWhen_SenderNotBurner() public { // OZ Access Control v4.8.3 inherited by BurnMintERC20 does not use custom errors, but the revert message is still useful // and should be checked vm.expectRevert( @@ -38,7 +38,7 @@ contract BurnMintERC20burnFrom is BurnMintERC20Setup { s_burnMintERC20.burnFrom(OWNER, s_amount); } - function test_burnFrom_InsufficientAllowance_Reverts() public { + function test_burnFrom_RevertWhen_InsufficientAllowance() public { changePrank(s_mockPool); vm.expectRevert("ERC20: insufficient allowance"); @@ -46,7 +46,7 @@ contract BurnMintERC20burnFrom is BurnMintERC20Setup { s_burnMintERC20.burnFrom(OWNER, s_amount); } - function test_burnFrom_ExceedsBalance_Reverts() public { + function test_burnFrom_RevertWhen_ExceedsBalance() public { s_burnMintERC20.approve(s_mockPool, s_amount * 2); changePrank(s_mockPool); diff --git a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burnFromAlias.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burnFromAlias.t.sol index d413e0c5ad8..d619968b8f1 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burnFromAlias.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burnFromAlias.t.sol @@ -6,12 +6,12 @@ import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol"; import {Strings} from "../../../../../vendor/openzeppelin-solidity/v4.8.3/contracts/utils/Strings.sol"; -contract BurnMintERC20burnFromAlias is BurnMintERC20Setup { +contract BurnMintERC20_burnFromAlias is BurnMintERC20Setup { function setUp() public virtual override { BurnMintERC20Setup.setUp(); } - function test_burn_Success() public { + function test_burn() public { s_burnMintERC20.approve(s_mockPool, s_amount); changePrank(s_mockPool); @@ -23,7 +23,7 @@ contract BurnMintERC20burnFromAlias is BurnMintERC20Setup { // Reverts - function test_burn_SenderNotBurner_Reverts() public { + function test_burn_RevertWhen_SenderNotBurner() public { // OZ Access Control v4.8.3 inherited by BurnMintERC20 does not use custom errors, but the revert message is still useful // and should be checked vm.expectRevert( @@ -38,7 +38,7 @@ contract BurnMintERC20burnFromAlias is BurnMintERC20Setup { s_burnMintERC20.burn(OWNER, s_amount); } - function test_burn_InsufficientAllowance_Reverts() public { + function test_burn_RevertWhen_InsufficientAllowance() public { changePrank(s_mockPool); vm.expectRevert("ERC20: insufficient allowance"); @@ -46,7 +46,7 @@ contract BurnMintERC20burnFromAlias is BurnMintERC20Setup { s_burnMintERC20.burn(OWNER, s_amount); } - function test_burn_ExceedsBalance_Reverts() public { + function test_burn_RevertWhen_ExceedsBalance() public { s_burnMintERC20.approve(s_mockPool, s_amount * 2); changePrank(s_mockPool); diff --git a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.ccipGetAdmin.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.ccipGetAdmin.t.sol index 682670d5e69..25b9fa8f2df 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.ccipGetAdmin.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.ccipGetAdmin.t.sol @@ -4,12 +4,12 @@ pragma solidity 0.8.24; import {BurnMintERC20} from "../../../../token/ERC20/BurnMintERC20.sol"; import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol"; -contract BurnMintERC20getCCIPAdmin is BurnMintERC20Setup { - function test_getCCIPAdmin_Success() public view { +contract BurnMintERC20_getCCIPAdmin is BurnMintERC20Setup { + function test_getCCIPAdmin() public view { assertEq(OWNER, s_burnMintERC20.getCCIPAdmin()); } - function test_setCCIPAdmin_Success() public { + function test_setCCIPAdmin() public { address newAdmin = makeAddr("newAdmin"); vm.expectEmit(); diff --git a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.constructor.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.constructor.t.sol index 4dc81317d77..b5de63b9b31 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.constructor.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.constructor.t.sol @@ -4,8 +4,8 @@ pragma solidity 0.8.24; import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol"; import {BurnMintERC20} from "../../../../token/ERC20/BurnMintERC20.sol"; -contract BurnMintERC20constructor is BurnMintERC20Setup { - function test_Constructor_Success() public { +contract BurnMintERC20_constructor is BurnMintERC20Setup { + function test_Constructor() public { vm.startPrank(s_alice); string memory name = "Chainlink token v2"; diff --git a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.grantMintAndBurnRoles.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.grantMintAndBurnRoles.t.sol index 24f6f24254d..7a31d2aa078 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.grantMintAndBurnRoles.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.grantMintAndBurnRoles.t.sol @@ -6,8 +6,8 @@ import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol"; import {IAccessControl} from "../../../../../vendor/openzeppelin-solidity/v4.8.3/contracts/access/IAccessControl.sol"; -contract BurnMintERC20grantMintAndBurnRoles is BurnMintERC20Setup { - function test_GrantMintAndBurnRoles_Success() public { +contract BurnMintERC20_grantMintAndBurnRoles is BurnMintERC20Setup { + function test_GrantMintAndBurnRoles() public { assertFalse(s_burnMintERC20.hasRole(s_burnMintERC20.MINTER_ROLE(), STRANGER)); assertFalse(s_burnMintERC20.hasRole(s_burnMintERC20.BURNER_ROLE(), STRANGER)); diff --git a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.mint.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.mint.t.sol index bdb3ff61505..fd97b80fa60 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.mint.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.mint.t.sol @@ -7,7 +7,7 @@ import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol"; import {IERC20} from "../../../../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol"; import {Strings} from "../../../../../vendor/openzeppelin-solidity/v4.8.3/contracts/utils/Strings.sol"; -contract BurnMintERC20mint is BurnMintERC20Setup { +contract BurnMintERC20_mint is BurnMintERC20Setup { function test_mint() public { uint256 balancePre = s_burnMintERC20.balanceOf(OWNER); diff --git a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.supportsInterface.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.supportsInterface.t.sol index d164d2108a5..aa495d047ed 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.supportsInterface.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.supportsInterface.t.sol @@ -8,8 +8,8 @@ import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol"; import {IERC20} from "../../../../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol"; import {IERC165} from "../../../../../vendor/openzeppelin-solidity/v4.8.3/contracts/utils/introspection/IERC165.sol"; -contract BurnMintERC20supportsInterface is BurnMintERC20Setup { - function test_SupportsInterface_Success() public view { +contract BurnMintERC20_supportsInterface is BurnMintERC20Setup { + function test_SupportsInterface() public view { assertTrue(s_burnMintERC20.supportsInterface(type(IERC20).interfaceId)); assertTrue(s_burnMintERC20.supportsInterface(type(IBurnMintERC20).interfaceId)); assertTrue(s_burnMintERC20.supportsInterface(type(IERC165).interfaceId)); diff --git a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.transfer.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.transfer.t.sol index ebaca4c18fc..6d21e507478 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.transfer.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.transfer.t.sol @@ -4,8 +4,8 @@ pragma solidity 0.8.24; import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol"; import {BurnMintERC20} from "../../../../token/ERC20/BurnMintERC20.sol"; -contract BurnMintERC20transfer is BurnMintERC20Setup { - function test_transfer_Success() public { +contract BurnMintERC20_transfer is BurnMintERC20Setup { + function test_transfer() public { uint256 balancePre = s_burnMintERC20.balanceOf(STRANGER); uint256 sendingAmount = s_amount / 2; @@ -16,7 +16,7 @@ contract BurnMintERC20transfer is BurnMintERC20Setup { // Reverts - function test_transfer_InvalidAddress_Reverts() public { + function test_transfer_RevertWhen_InvalidAddress() public { vm.expectRevert(abi.encodeWithSelector(BurnMintERC20.InvalidRecipient.selector, address(s_burnMintERC20))); s_burnMintERC20.transfer(address(s_burnMintERC20), s_amount);