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

test: move forge-std test to external tests #7227

Merged
merged 1 commit into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 0 additions & 6 deletions .github/scripts/matrices.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,6 @@ def __init__(
n_partitions=2,
pr_cross_platform=False,
),
Case(
name="integration / forge-std",
filter="package(=forge) & test(~forge_std)",
n_partitions=1,
pr_cross_platform=False,
),
Case(
name="integration / external",
filter="package(=forge) & test(~ext_integration)",
Expand Down
6 changes: 2 additions & 4 deletions crates/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,8 @@ pub struct Config {
/// included in solc's output selection, see also
/// [OutputSelection](foundry_compilers::artifacts::output_selection::OutputSelection)
pub sparse_mode: bool,
/// Whether to emit additional build info files
///
/// If set to `true`, `ethers-solc` will generate additional build info json files for every
/// new build, containing the `CompilerInput` and `CompilerOutput`
/// Generates additional build info json files for every new build, containing the
/// `CompilerInput` and `CompilerOutput`.
pub build_info: bool,
/// The path to the `build-info` directory that contains the build info json files.
pub build_info_path: Option<PathBuf>,
Expand Down
8 changes: 8 additions & 0 deletions crates/forge/tests/cli/ext_integration.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
use foundry_test_utils::util::ExtTester;

#[test]
fn forge_std() {
ExtTester::new("foundry-rs", "forge-std", "1d0766bc5d814f117c7b1e643828f7d85024fb51")
// Skip fork tests.
.args(["--nmc", "Fork"])
.run();
}

#[test]
fn solmate() {
ExtTester::new("transmissions11", "solmate", "c892309933b25c03d32b1b0d674df7ae292ba925").run();
Expand Down
27 changes: 1 addition & 26 deletions crates/forge/tests/cli/test_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use foundry_common::rpc;
use foundry_config::Config;
use foundry_test_utils::util::{OutputExt, OTHER_SOLC_VERSION, SOLC_VERSION};
use std::{path::PathBuf, process::Command, str::FromStr};
use std::{path::PathBuf, str::FromStr};

// tests that test filters are handled correctly
forgetest!(can_set_filter_values, |prj, cmd| {
Expand Down Expand Up @@ -259,31 +259,6 @@ contract ContractTest is DSTest {
);
});

// checks that we can test forge std successfully
// `forgetest_init!` will install with `forge-std` under `lib/forge-std`
forgetest_init!(
#[serial_test::serial]
can_test_forge_std,
|prj, cmd| {
let forge_std_dir = prj.root().join("lib/forge-std");
let status = Command::new("git")
.current_dir(&forge_std_dir)
.args(["pull", "origin", "master"])
.status()
.unwrap();
if !status.success() {
panic!("failed to update forge-std");
}

// execute in subdir
cmd.cmd().current_dir(forge_std_dir);
cmd.args(["test", "--root", "."]);
let stdout = cmd.stdout_lossy();
assert!(stdout.contains("[PASS]"), "No tests passed:\n{stdout}");
assert!(!stdout.contains("[FAIL]"), "Tests failed:\n{stdout}");
}
);

// tests that libraries are handled correctly in multiforking mode
forgetest_init!(can_use_libs_in_multi_fork, |prj, cmd| {
prj.wipe_contracts();
Expand Down
Loading