Skip to content

Commit 04cc1ca

Browse files
authored
Merge branch 'master' into issue-9840
2 parents 0f9bfb6 + dae1a12 commit 04cc1ca

File tree

9 files changed

+57
-4
lines changed

9 files changed

+57
-4
lines changed

crates/forge/src/result.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,15 @@ impl TestOutcome {
192192
successes.to_string().green()
193193
)?;
194194

195+
// Show helpful hint for rerunning failed tests
196+
let test_word = if failures == 1 { "test" } else { "tests" };
197+
sh_println!(
198+
"\nTip: Run {} to retry only the {} failed {}",
199+
"`forge test --rerun`".cyan(),
200+
failures,
201+
test_word
202+
)?;
203+
195204
// TODO: Avoid process::exit
196205
std::process::exit(1);
197206
}

crates/forge/tests/cli/cmd.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2850,7 +2850,7 @@ contract NestedDeploy is Test {
28502850
+============================================================================================+
28512851
| Deployment Cost | Deployment Size | | | | |
28522852
|-------------------------------------------+-----------------+-----+--------+-----+---------|
2853-
| 328949 | 1163 | | | | |
2853+
| 328961 | 1163 | | | | |
28542854
|-------------------------------------------+-----------------+-----+--------+-----+---------|
28552855
| | | | | | |
28562856
|-------------------------------------------+-----------------+-----+--------+-----+---------|
@@ -2905,7 +2905,7 @@ Ran 1 test suite [ELAPSED]: 1 tests passed, 0 failed, 0 skipped (1 total tests)
29052905
{
29062906
"contract": "test/NestedDeployTest.sol:Parent",
29072907
"deployment": {
2908-
"gas": 328949,
2908+
"gas": 328961,
29092909
"size": 1163
29102910
},
29112911
"functions": {

crates/forge/tests/cli/eip712.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ Encountered 1 failing test in test/Structs.sol:DummyTest
175175
176176
Encountered a total of 1 failing tests, 0 tests succeeded
177177
178+
Tip: Run `forge test --rerun` to retry only the 1 failed test
179+
178180
"#]]);
179181
});
180182

@@ -394,6 +396,8 @@ Encountered 1 failing test in src/Eip712Cheat.sol:Eip712Test
394396
395397
Encountered a total of 1 failing tests, 0 tests succeeded
396398
399+
Tip: Run `forge test --rerun` to retry only the 1 failed test
400+
397401
"#]]);
398402

399403
cmd.forge_fuse().args(["bind-json"]).assert_success();
@@ -438,6 +442,8 @@ Encountered 1 failing test in src/Eip712Cheat.sol:Eip712Test
438442
439443
Encountered a total of 1 failing tests, 0 tests succeeded
440444
445+
Tip: Run `forge test --rerun` to retry only the 1 failed test
446+
441447
"#]]);
442448

443449
cmd.forge_fuse().args(["bind-json", "utils/CustomJsonBindings.sol"]).assert_success();

crates/forge/tests/cli/failure_assertions.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ Encountered 2 failing tests in src/DeprecationTestFail.t.sol:DeprecationTestFail
3333
3434
Encountered a total of 2 failing tests, 0 tests succeeded
3535
36+
Tip: Run `forge test --rerun` to retry only the 2 failed tests
37+
3638
"#]]);
3739
});
3840

crates/forge/tests/cli/inline_config.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ Encountered 1 failing test in test/inline.sol:Inline
161161
162162
Encountered a total of 1 failing tests, 0 tests succeeded
163163
164+
Tip: Run `forge test --rerun` to retry only the 1 failed test
165+
164166
"#]]);
165167
});
166168

@@ -192,6 +194,8 @@ Encountered 1 failing test in test/inline.sol:Inline
192194
193195
Encountered a total of 1 failing tests, 0 tests succeeded
194196
197+
Tip: Run `forge test --rerun` to retry only the 1 failed test
198+
195199
"#]]);
196200
});
197201

crates/forge/tests/cli/test_cmd.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,8 @@ Encountered 1 failing test in test/Contract.t.sol:CustomTypesTest
602602
603603
Encountered a total of 1 failing tests, 1 tests succeeded
604604
605+
Tip: Run `forge test --rerun` to retry only the 1 failed test
606+
605607
"#]]);
606608
});
607609

@@ -763,6 +765,8 @@ Encountered 1 failing test in test/CounterFuzz.t.sol:CounterTest
763765
764766
Encountered a total of 1 failing tests, 0 tests succeeded
765767
768+
Tip: Run `forge test --rerun` to retry only the 1 failed test
769+
766770
"#]]);
767771
});
768772

@@ -813,6 +817,8 @@ Encountered 1 failing test in test/CounterInvariant.t.sol:CounterTest
813817
814818
Encountered a total of 1 failing tests, 0 tests succeeded
815819
820+
Tip: Run `forge test --rerun` to retry only the 1 failed test
821+
816822
"#]]);
817823
});
818824

@@ -864,6 +870,8 @@ Encountered 2 failing tests in test/ReplayFailures.t.sol:ReplayFailuresTest
864870
865871
Encountered a total of 2 failing tests, 2 tests succeeded
866872
873+
Tip: Run `forge test --rerun` to retry only the 2 failed tests
874+
867875
"#]]);
868876

869877
// Test failure filter should be persisted.
@@ -887,6 +895,8 @@ Encountered 2 failing tests in test/ReplayFailures.t.sol:ReplayFailuresTest
887895
888896
Encountered a total of 2 failing tests, 0 tests succeeded
889897
898+
Tip: Run `forge test --rerun` to retry only the 2 failed tests
899+
890900
"#]]);
891901
});
892902

@@ -2871,6 +2881,8 @@ Encountered 1 failing test in test/Foo.t.sol:ContractTest
28712881
28722882
Encountered a total of 1 failing tests, 0 tests succeeded
28732883
2884+
Tip: Run `forge test --rerun` to retry only the 1 failed test
2885+
28742886
"#]]);
28752887
});
28762888

@@ -3001,6 +3013,8 @@ Encountered 1 failing test in test/SuppressTracesTest.t.sol:SuppressTracesTest
30013013
30023014
Encountered a total of 1 failing tests, 1 tests succeeded
30033015
3016+
Tip: Run `forge test --rerun` to retry only the 1 failed test
3017+
30043018
"#]],
30053019
);
30063020

@@ -3063,6 +3077,8 @@ Encountered 1 failing test in test/SuppressTracesTest.t.sol:SuppressTracesTest
30633077
30643078
Encountered a total of 1 failing tests, 1 tests succeeded
30653079
3080+
Tip: Run `forge test --rerun` to retry only the 1 failed test
3081+
30663082
"#]]);
30673083
});
30683084

@@ -3747,6 +3763,8 @@ Encountered 1 failing test in test/Counter.t.sol:CounterTest
37473763
37483764
Encountered a total of 1 failing tests, 0 tests succeeded
37493765
3766+
Tip: Run `forge test --rerun` to retry only the 1 failed test
3767+
37503768
"#]]);
37513769
});
37523770

@@ -3855,6 +3873,8 @@ Encountered 3 failing tests in test/NonContractCallRevertTest.t.sol:NonContractC
38553873
38563874
Encountered a total of 3 failing tests, 0 tests succeeded
38573875
3876+
Tip: Run `forge test --rerun` to retry only the 3 failed tests
3877+
38583878
"#]]);
38593879
});
38603880

@@ -3937,6 +3957,8 @@ Encountered 1 failing test in test/NonContractDelegateCallRevertTest.t.sol:NonCo
39373957
39383958
Encountered a total of 1 failing tests, 0 tests succeeded
39393959
3960+
Tip: Run `forge test --rerun` to retry only the 1 failed test
3961+
39403962
"#]]);
39413963
});
39423964

@@ -4128,5 +4150,7 @@ Encountered 2 failing tests in test/Counter.t.sol:CounterTest
41284150
41294151
Encountered a total of 2 failing tests, 0 tests succeeded
41304152
4153+
Tip: Run `forge test --rerun` to retry only the 2 failed tests
4154+
41314155
"#]]);
41324156
});

crates/forge/tests/it/invariant.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ contract BalanceAssumeTest is Test {
806806

807807
cmd.args(["test", "--mt", "invariant_balance"]).assert_failure().stdout_eq(str![[r#"
808808
...
809-
[FAIL: `vm.assume` rejected too many inputs (10 allowed)] invariant_balance() (runs: 5, calls: 2500, reverts: 0)
809+
[FAIL: `vm.assume` rejected too many inputs (10 allowed)] invariant_balance() (runs: 2, calls: 1000, reverts: 0)
810810
...
811811
"#]]);
812812
});
@@ -1112,6 +1112,8 @@ Encountered 1 failing test in test/InvariantSequenceLenTest.t.sol:InvariantSeque
11121112
11131113
Encountered a total of 1 failing tests, 0 tests succeeded
11141114
1115+
Tip: Run `forge test --rerun` to retry only the 1 failed test
1116+
11151117
"#]],
11161118
);
11171119

@@ -1137,6 +1139,8 @@ Encountered 1 failing test in test/InvariantSequenceLenTest.t.sol:InvariantSeque
11371139
11381140
Encountered a total of 1 failing tests, 0 tests succeeded
11391141
1142+
Tip: Run `forge test --rerun` to retry only the 1 failed test
1143+
11401144
"#]],
11411145
);
11421146

@@ -1158,6 +1162,8 @@ Encountered 1 failing test in test/InvariantSequenceLenTest.t.sol:InvariantSeque
11581162
11591163
Encountered a total of 1 failing tests, 0 tests succeeded
11601164
1165+
Tip: Run `forge test --rerun` to retry only the 1 failed test
1166+
11611167
"#]],
11621168
);
11631169
});

crates/forge/tests/it/table.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ Encountered 6 failing tests in test/CounterTable.t.sol:CounterTableTest
117117
118118
Encountered a total of 6 failing tests, 2 tests succeeded
119119
120+
Tip: Run `forge test --rerun` to retry only the 6 failed tests
121+
120122
"#]]);
121123
});
122124

testdata/forge-std-rev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8bbcf6e3f8f62f419e5429a0bd89331c85c37824
1+
8e40513d678f392f398620b3ef2b418648b33e89

0 commit comments

Comments
 (0)