Skip to content

Commit bd412c4

Browse files
committed
fix(harness)!: Rename Harness::cases to discover
1 parent 3e54ab1 commit bd412c4

11 files changed

Lines changed: 12 additions & 12 deletions

File tree

crates/libtest2-harness/src/harness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ impl Harness {
1818
Self { raw, cases: vec![] }
1919
}
2020

21-
pub fn cases(&mut self, cases: impl IntoIterator<Item = impl Case + 'static>) {
21+
pub fn discover(&mut self, cases: impl IntoIterator<Item = impl Case + 'static>) {
2222
for case in cases {
2323
self.cases.push(Box::new(case));
2424
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use libtest2_mimic::Trial;
55

66
fn main() {
77
libtest2_mimic::Harness::with_env()
8-
.cases([
8+
.discover([
99
Trial::test("check_toph", check_toph),
1010
Trial::test("check_katara", check_katara),
1111
Trial::test("check_sokka", check_sokka),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use libtest2_mimic::Trial;
44

55
fn main() -> std::io::Result<()> {
66
let tests = collect_tests()?;
7-
libtest2_mimic::Harness::with_env().cases(tests).main()
7+
libtest2_mimic::Harness::with_env().discover(tests).main()
88
}
99

1010
/// Creates one test for each `.rs` file in the current directory or

crates/libtest2-mimic/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ impl Harness {
4343
}
4444
}
4545

46-
pub fn cases(mut self, cases: impl IntoIterator<Item = Trial>) -> Self {
46+
pub fn discover(mut self, cases: impl IntoIterator<Item = Trial>) -> Self {
4747
self.harness
48-
.cases(cases.into_iter().map(|c| TrialCase { inner: c }));
48+
.discover(cases.into_iter().map(|c| TrialCase { inner: c }));
4949
self
5050
}
5151

crates/libtest2-mimic/tests/testsuite/all_passing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fn test_cmd() -> snapbox::cmd::Command {
1010
fn main() {
1111
use libtest2_mimic::Trial;
1212
libtest2_mimic::Harness::with_env()
13-
.cases(vec![
13+
.discover([
1414
Trial::test("foo", |_| Ok(())),
1515
Trial::test("bar", |_| Ok(())),
1616
Trial::test("barro", |_| Ok(())),

crates/libtest2-mimic/tests/testsuite/argfile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn main() {
1111
use libtest2_mimic::Trial;
1212
use libtest2_mimic::RunError;
1313
libtest2_mimic::Harness::with_env()
14-
.cases(vec![
14+
.discover([
1515
Trial::test("one", |_| Ok(())),
1616
Trial::test("two", |_| Ok(())),
1717
Trial::test("three", |_| Ok(())),

crates/libtest2-mimic/tests/testsuite/main_thread.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fn main() {
88
use libtest2_mimic::Trial;
99
let outer_thread = std::thread::current().id();
1010
libtest2_mimic::Harness::with_env()
11-
.cases(vec![
11+
.discover([
1212
Trial::test("check", move |_| {
1313
assert_eq!(outer_thread, std::thread::current().id());
1414
Ok(())

crates/libtest2-mimic/tests/testsuite/mixed_bag.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn main() {
1111
use libtest2_mimic::Trial;
1212
use libtest2_mimic::RunError;
1313
libtest2_mimic::Harness::with_env()
14-
.cases(vec![
14+
.discover([
1515
Trial::test("cat", |_| Ok(())),
1616
Trial::test("dog", |_| Err(RunError::fail("was not a good boy"))),
1717
Trial::test("fox", |_| Ok(())),

crates/libtest2-mimic/tests/testsuite/panic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fn test_cmd() -> snapbox::cmd::Command {
1010
fn main() {
1111
use libtest2_mimic::Trial;
1212
libtest2_mimic::Harness::with_env()
13-
.cases(vec![
13+
.discover([
1414
Trial::test("passes", |_| Ok(())),
1515
Trial::test("panics", |_| panic!("uh oh")),
1616
])

crates/libtest2/examples/tidy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use libtest2::Trial;
55
fn main() -> std::io::Result<()> {
66
let tests = collect_tests()?;
77
let mut harness = libtest2::Harness::with_env();
8-
harness.cases(tests);
8+
harness.discover(tests);
99
harness.main()
1010
}
1111

0 commit comments

Comments
 (0)