Skip to content
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
25 changes: 8 additions & 17 deletions crates/forge/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,23 +383,14 @@ impl<'a> ContractRunner<'a> {
load_contracts(setup.traces.iter().map(|(_, t)| &t.arena), &self.mcr.known_contracts)
});

let test_fail_instances = functions
.iter()
.filter_map(|func| {
TestFunctionKind::classify(&func.name, !func.inputs.is_empty())
.is_any_test_fail()
.then_some(func.name.clone())
})
.collect::<Vec<_>>();

if !test_fail_instances.is_empty() {
let instances = format!(
"Found {} instances: {}",
test_fail_instances.len(),
test_fail_instances.join(", ")
);
let fail = TestResult::fail("`testFail*` has been removed. Consider changing to test_Revert[If|When]_Condition and expecting a revert".to_string());
return SuiteResult::new(start.elapsed(), [(instances, fail)].into(), warnings);
let test_fail_functions =
functions.iter().filter(|func| func.test_function_kind().is_any_test_fail());
if test_fail_functions.clone().next().is_some() {
let fail = || {
TestResult::fail("`testFail*` has been removed. Consider changing to test_Revert[If|When]_Condition and expecting a revert".to_string())
};
let test_results = test_fail_functions.map(|func| (func.signature(), fail())).collect();
return SuiteResult::new(start.elapsed(), test_results, warnings);
}

let fail_fast = &self.tcfg.fail_fast;
Expand Down
20 changes: 13 additions & 7 deletions crates/forge/tests/cli/failure_assertions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,21 @@ forgetest!(test_fail_deprecation, |prj, cmd| {
"#,
);

cmd.forge_fuse().args(["test", "--mc", "DeprecationTestFail"]).assert_failure().stdout_eq(
r#"[COMPILING_FILES] with [SOLC_VERSION]
cmd.forge_fuse()
.args(["test", "--mc", "DeprecationTestFail"])
.assert_failure()
.stdout_eq(str![[r#"
[COMPILING_FILES] with [SOLC_VERSION]
[SOLC_VERSION] [ELAPSED]
...
[FAIL: `testFail*` has been removed. Consider changing to test_Revert[If|When]_Condition and expecting a revert] Found 2 instances: testFail_deprecated, testFail_deprecated2 ([GAS])
Suite result: FAILED. 0 passed; 1 failed; 0 skipped; [ELAPSED]
...
"#,
);
Failing tests:
Encountered 2 failing tests in src/DeprecationTestFail.t.sol:DeprecationTestFail
[FAIL: `testFail*` has been removed. Consider changing to test_Revert[If|When]_Condition and expecting a revert] testFail_deprecated() ([GAS])
[FAIL: `testFail*` has been removed. Consider changing to test_Revert[If|When]_Condition and expecting a revert] testFail_deprecated2() ([GAS])
Encountered a total of 2 failing tests, 0 tests succeeded
"#]]);
});

forgetest!(expect_revert_tests_should_fail, |prj, cmd| {
Expand Down
12 changes: 0 additions & 12 deletions crates/forge/tests/it/repros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,6 @@ test_repro!(3347, false, None, |res| {
);
});

// https://github.com/foundry-rs/foundry/issues/3437
// 1.0 related
// test_repro!(3437);

// https://github.com/foundry-rs/foundry/issues/3596
test_repro!(3596, true, None);

Expand All @@ -170,10 +166,6 @@ test_repro!(
// https://github.com/foundry-rs/foundry/issues/3708
test_repro!(3708);

// https://github.com/foundry-rs/foundry/issues/3723
// 1.0 related
// test_repro!(3723);

// https://github.com/foundry-rs/foundry/issues/3753
test_repro!(3753);

Expand All @@ -195,10 +187,6 @@ test_repro!(4630);
// https://github.com/foundry-rs/foundry/issues/4640
test_repro!(4640);

// https://github.com/foundry-rs/foundry/issues/4832
// 1.0 related
// test_repro!(4832);

// https://github.com/foundry-rs/foundry/issues/5038
test_repro!(5038);

Expand Down
19 changes: 0 additions & 19 deletions testdata/default/repros/Issue3437.t.sol

This file was deleted.

18 changes: 0 additions & 18 deletions testdata/default/repros/Issue3723.t.sol

This file was deleted.

17 changes: 0 additions & 17 deletions testdata/default/repros/Issue4832.t.sol

This file was deleted.

Loading