pub fn observer_host_main(
provider: &str,
tests: &[TestRegistration],
) -> Result<()>Examples found in repository?
examples/host_example.rs (line 21)
5fn main() {
6 let tests = collect_tests(|| {
7 describe!("pkg", {
8 test!("smoke test", id = "pkg::smoke", |ctx| {
9 ctx.stdout("ok\n");
10 expect(true).to_be_truthy();
11 });
12
13 test!("failing test", id = "pkg::fail", |ctx| {
14 ctx.stderr("failure\n");
15 ctx.set_exit(1);
16 });
17 });
18 })
19 .expect("collection should validate");
20
21 let exit_code = match observer_host_main("rust", &tests) {
22 Ok(()) => 0,
23 Err(error) => {
24 eprintln!("{error}");
25 2
26 }
27 };
28 std::process::exit(exit_code);
29}