Skip to content

Commit 3e54ab1

Browse files
committed
fix(harness)!: Remove singular case addition
1 parent 024c188 commit 3e54ab1

4 files changed

Lines changed: 11 additions & 16 deletions

File tree

crates/libtest2-harness/src/harness.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ impl Harness {
1818
Self { raw, cases: vec![] }
1919
}
2020

21-
pub fn case(&mut self, case: impl Case + 'static) {
22-
self.cases.push(Box::new(case));
23-
}
24-
2521
pub fn cases(&mut self, cases: impl IntoIterator<Item = impl Case + 'static>) {
2622
for case in cases {
2723
self.cases.push(Box::new(case));

crates/libtest2-mimic/examples/mimic-simple.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ use libtest2_mimic::Trial;
55

66
fn main() {
77
libtest2_mimic::Harness::with_env()
8-
.case(Trial::test("check_toph", check_toph))
9-
.case(Trial::test("check_katara", check_katara))
10-
.case(Trial::test("check_sokka", check_sokka))
11-
.case(Trial::test("long_computation", long_computation))
12-
.case(Trial::test("compile_fail_dummy", compile_fail_dummy))
8+
.cases([
9+
Trial::test("check_toph", check_toph),
10+
Trial::test("check_katara", check_katara),
11+
Trial::test("check_sokka", check_sokka),
12+
Trial::test("long_computation", long_computation),
13+
Trial::test("compile_fail_dummy", compile_fail_dummy),
14+
])
1315
.main();
1416
}
1517

crates/libtest2-mimic/src/lib.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@ impl Harness {
4343
}
4444
}
4545

46-
pub fn case(mut self, case: Trial) -> Self {
47-
self.harness.case(TrialCase { inner: case });
48-
self
49-
}
50-
5146
pub fn cases(mut self, cases: impl IntoIterator<Item = Trial>) -> Self {
5247
self.harness
5348
.cases(cases.into_iter().map(|c| TrialCase { inner: c }));

crates/libtest2/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,10 @@ macro_rules! libtest2_main {
7676
( $( $test:path ),* $(,)*) => {
7777
fn main() {
7878
let mut harness = ::libtest2::Harness::with_env();
79-
$(harness.case(::libtest2::Trial::test(::std::stringify!($test), $test));)*
80-
harness.main();
79+
harness.cases([
80+
$(::libtest2::Trial::test(::std::stringify!($test), $test)),*
81+
]);
82+
harness.main();
8183
}
8284
}
8385
}

0 commit comments

Comments
 (0)