Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move test utils in the src dir #176

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,20 @@ jobs:
key: "foundry-build-${{ github.sha }}"
path: "out-optimized"

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "pnpm"
node-version: "lts/*"

- name: "Install the Node.js dependencies"
run: "pnpm install"

- name: "Run the tests against the optimized build"
run: "FOUNDRY_PROFILE=test-optimized forge test"

Expand All @@ -136,6 +150,20 @@ jobs:
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "pnpm"
node-version: "lts/*"

- name: "Install the Node.js dependencies"
run: "pnpm install"

- name: "Run the tests and generate the coverage report"
run: "forge coverage --report lcov"

Expand Down
1 change: 0 additions & 1 deletion lib/prb-test
Submodule prb-test deleted from cfc05f
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"bugs": {
"url": "https://github.com/PaulRBerg/prb-proxy/issues"
},
"dependencies": {
andreivladbrg marked this conversation as resolved.
Show resolved Hide resolved
"@prb/test": "0.6.4"
},
"devDependencies": {
"prettier": "^2.8.8",
"solhint-community": "^3.5.2"
Expand Down
9 changes: 9 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion remappings.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@prb/test/=lib/prb-test/src/
@prb/test/=node_modules/@prb/test
forge-std/=lib/forge-std/src/
2 changes: 1 addition & 1 deletion shell/update-precompiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ FOUNDRY_PROFILE=optimized forge build
# Retrieve the raw bytecodes, removing the "0x" prefix
registry=$(cat out-optimized/PRBProxyRegistry.sol/PRBProxyRegistry.json | jq -r '.bytecode.object' | cut -c 3-)

precompiles_path="test/utils/Precompiles.sol"
precompiles_path="src/test/Precompiles.sol"
if [ ! -f $precompiles_path ]; then
echo "Precompiles file does not exist"
exit 1
Expand Down
2 changes: 1 addition & 1 deletion test/utils/Assertions.sol → src/test/Assertions.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.18;

import { PRBTest } from "@prb/test/PRBTest.sol";
import { PRBTest } from "@prb/test/src/PRBTest.sol";

import { IPRBProxyPlugin } from "../../src/interfaces/IPRBProxyPlugin.sol";

Expand Down
4 changes: 2 additions & 2 deletions test/utils/Events.sol → src/test/Events.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.18;

import { IPRBProxy } from "../../src/interfaces/IPRBProxy.sol";
import { IPRBProxyPlugin } from "../../src/interfaces/IPRBProxyPlugin.sol";
import { IPRBProxy } from "../interfaces/IPRBProxy.sol";
import { IPRBProxyPlugin } from "../interfaces/IPRBProxyPlugin.sol";

/// @notice Abstract contract containing all the events emitted by the protocol.
abstract contract Events {
Expand Down
2 changes: 1 addition & 1 deletion test/utils/Precompiles.sol → src/test/Precompiles.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// solhint-disable max-line-length
pragma solidity >=0.8.18;

import { IPRBProxyRegistry } from "../../src/interfaces/IPRBProxyRegistry.sol";
import { IPRBProxyRegistry } from "../interfaces/IPRBProxyRegistry.sol";

/// @notice This is useful for external integrations seeking to test against the exact deployed bytecode, as recompiling
/// with via IR enabled would be time-consuming.
Expand Down
6 changes: 3 additions & 3 deletions test/Base.t.sol
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.19 <=0.9.0;

import { eqString } from "@prb/test/Helpers.sol";
import { eqString } from "@prb/test/src/Helpers.sol";
import { StdCheats } from "forge-std/StdCheats.sol";
import { StdUtils } from "forge-std/StdUtils.sol";

import { IPRBProxy } from "../src/interfaces/IPRBProxy.sol";
import { IPRBProxyRegistry } from "../src/interfaces/IPRBProxyRegistry.sol";
import { PRBProxy } from "../src/PRBProxy.sol";
import { PRBProxyRegistry } from "../src/PRBProxyRegistry.sol";
import { Assertions } from "../src/test/Assertions.sol";
import { Events } from "../src/test/Events.sol";

import { PluginBasic } from "./mocks/plugins/PluginBasic.sol";
import { PluginCollider } from "./mocks/plugins/PluginCollider.sol";
Expand All @@ -23,8 +25,6 @@ import { TargetEcho } from "./mocks/targets/TargetEcho.sol";
import { TargetPanic } from "./mocks/targets/TargetPanic.sol";
import { TargetReverter } from "./mocks/targets/TargetReverter.sol";
import { TargetSelfDestructer } from "./mocks/targets/TargetSelfDestructer.sol";
import { Assertions } from "./utils/Assertions.sol";
import { Events } from "./utils/Events.sol";

/// @notice Base test contract with common logic needed by all test contracts.
abstract contract Base_Test is Assertions, Events, StdCheats, StdUtils {
Expand Down
2 changes: 1 addition & 1 deletion test/utils/Precompiles.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity >=0.8.18;

import { Base_Test } from "../Base.t.sol";
import { Precompiles } from "./Precompiles.sol";
import { Precompiles } from "../../src/test/Precompiles.sol";

contract Precompiles_Test is Base_Test {
Precompiles internal precompiles = new Precompiles();
Expand Down