Skip to content

Commit e9ee660

Browse files
test(contracts): add version format validation for OptimismSuperchainERC20Beacon
Add OptimismSuperchainERC20Beacon_Version_Test with SemverComp.parse() to validate the version string follows proper semver format.
1 parent 6244dfd commit e9ee660

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

packages/contracts-bedrock/test/L2/OptimismSuperchainERC20Beacon.t.sol

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ import {CommonTest} from "test/setup/CommonTest.sol";
66

77
// Libraries
88
import {Predeploys} from "src/libraries/Predeploys.sol";
9+
import {SemverComp} from "src/libraries/SemverComp.sol";
910
import {IBeacon} from "@openzeppelin/contracts/proxy/beacon/IBeacon.sol";
1011

12+
// Interfaces
13+
import {ISemver} from "interfaces/universal/ISemver.sol";
14+
1115
/// @title OptimismSuperchainERC20Beacon_TestInit
1216
/// @notice Reusable test initialization for `OptimismSuperchainERC20Beacon` tests.
1317
abstract contract OptimismSuperchainERC20Beacon_TestInit is CommonTest {
@@ -31,3 +35,13 @@ contract OptimismSuperchainERC20Beacon_Implementation_Test is OptimismSuperchain
3135
assertEq(beacon.implementation(), Predeploys.OPTIMISM_SUPERCHAIN_ERC20);
3236
}
3337
}
38+
39+
/// @title OptimismSuperchainERC20Beacon_Version_Test
40+
/// @notice Tests the `version` function of the
41+
/// `OptimismSuperchainERC20Beacon` contract.
42+
contract OptimismSuperchainERC20Beacon_Version_Test is OptimismSuperchainERC20Beacon_TestInit {
43+
/// @notice Tests that version returns a valid semver string.
44+
function test_version_succeeds() external view {
45+
SemverComp.parse(ISemver(Predeploys.OPTIMISM_SUPERCHAIN_ERC20_BEACON).version());
46+
}
47+
}

0 commit comments

Comments
 (0)