forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSemver.t.sol
35 lines (29 loc) · 1.14 KB
/
Semver.t.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
import { CommonTest } from "./CommonTest.t.sol";
import { Semver } from "../src/universal/Semver.sol";
import { Proxy } from "../src/universal/Proxy.sol";
/// @notice Test the Semver contract that is used for semantic versioning
/// of various contracts.
contract Semver_Test is CommonTest {
/// @notice Global semver contract deployed in setUp. This is used in
/// the test cases.
Semver semver;
/// @notice Deploy a Semver contract
function setUp() public virtual override {
semver = new Semver(7, 8, 0);
}
/// @notice Test the version getter
function test_version_succeeds() external {
assertEq(semver.version(), "7.8.0");
}
/// @notice Since the versions are all immutable, they should
/// be able to be accessed from behind a proxy without needing
/// to initialize the contract.
function test_behindProxy_succeeds() external {
Proxy proxy = new Proxy(alice);
vm.prank(alice);
proxy.upgradeTo(address(semver));
assertEq(Semver(address(proxy)).version(), "7.8.0");
}
}