Skip to content

Commit 4880714

Browse files
fix(test): one contract per file
rainix-sol-single-contract: test/abstract/BuildScript.t.sol declared both the spy and the test contract. The spy moves to its own file. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 7316b38 commit 4880714

2 files changed

Lines changed: 28 additions & 23 deletions

File tree

test/abstract/BuildScript.t.sol

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,7 @@
33
pragma solidity =0.8.25;
44

55
import {Test} from "forge-std-1.16.1/src/Test.sol";
6-
import {BuildScript} from "src/abstract/BuildScript.sol";
7-
8-
/// @notice Counts the hooks instead of running them, so the entrypoints are
9-
/// asserted on dispatch alone. The real `freeze` writes the tag dir named by
10-
/// `[package].version` — shared state that `LibSnapshot.t.sol` also drives, and
11-
/// forge runs test contracts concurrently, so touching it here would race
12-
/// rather than test.
13-
contract SpyBuildScript is BuildScript {
14-
uint256 public builds;
15-
uint256 public freezes;
16-
17-
function build() internal override {
18-
builds++;
19-
}
20-
21-
function snapshotContractNames() internal pure override returns (string[] memory names) {
22-
names = new string[](0);
23-
}
24-
25-
function freeze() internal override {
26-
freezes++;
27-
}
28-
}
6+
import {SpyBuildScript} from "./SpyBuildScript.sol";
297

308
/// @title BuildScriptTest
319
contract BuildScriptTest is Test {

test/abstract/SpyBuildScript.sol

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// SPDX-License-Identifier: LicenseRef-DCL-1.0
2+
// SPDX-FileCopyrightText: Copyright (c) 2020 Rain Open Source Software Ltd
3+
pragma solidity =0.8.25;
4+
5+
import {BuildScript} from "src/abstract/BuildScript.sol";
6+
7+
/// @notice Counts the hooks instead of running them, so the entrypoints are
8+
/// asserted on dispatch alone. The real `freeze` writes the tag dir named by
9+
/// `[package].version` — shared state that `LibSnapshot.t.sol` also drives, and
10+
/// forge runs test contracts concurrently, so touching it here would race
11+
/// rather than test.
12+
contract SpyBuildScript is BuildScript {
13+
uint256 public builds;
14+
uint256 public freezes;
15+
16+
function build() internal override {
17+
builds++;
18+
}
19+
20+
function snapshotContractNames() internal pure override returns (string[] memory names) {
21+
names = new string[](0);
22+
}
23+
24+
function freeze() internal override {
25+
freezes++;
26+
}
27+
}

0 commit comments

Comments
 (0)