diff options
Diffstat (limited to 'vendor/tracing-attributes/tests')
-rw-r--r-- | vendor/tracing-attributes/tests/async_fn.rs | 91 | ||||
-rw-r--r-- | vendor/tracing-attributes/tests/destructuring.rs | 54 | ||||
-rw-r--r-- | vendor/tracing-attributes/tests/err.rs | 101 | ||||
-rw-r--r-- | vendor/tracing-attributes/tests/fields.rs | 53 | ||||
-rw-r--r-- | vendor/tracing-attributes/tests/follows_from.rs | 26 | ||||
-rw-r--r-- | vendor/tracing-attributes/tests/instrument.rs | 54 | ||||
-rw-r--r-- | vendor/tracing-attributes/tests/levels.rs | 96 | ||||
-rw-r--r-- | vendor/tracing-attributes/tests/names.rs | 24 | ||||
-rw-r--r-- | vendor/tracing-attributes/tests/parents.rs | 14 | ||||
-rw-r--r-- | vendor/tracing-attributes/tests/ret.rs | 92 | ||||
-rw-r--r-- | vendor/tracing-attributes/tests/targets.rs | 40 |
11 files changed, 338 insertions, 307 deletions
diff --git a/vendor/tracing-attributes/tests/async_fn.rs b/vendor/tracing-attributes/tests/async_fn.rs index d6d874ffd..1d9273400 100644 --- a/vendor/tracing-attributes/tests/async_fn.rs +++ b/vendor/tracing-attributes/tests/async_fn.rs @@ -17,7 +17,6 @@ async fn test_async_fn(polls: usize) -> Result<(), ()> { #[allow(dead_code)] // this is just here to test whether it compiles. #[instrument] async fn test_ret_impl_trait(n: i32) -> Result<impl Iterator<Item = i32>, ()> { - let n = n; Ok((0..10).filter(move |x| *x < n)) } @@ -84,16 +83,16 @@ fn repro_1831_2() -> impl Future<Output = Result<(), Infallible>> { #[test] fn async_fn_only_enters_for_polls() { let (subscriber, handle) = subscriber::mock() - .new_span(span::mock().named("test_async_fn")) - .enter(span::mock().named("test_async_fn")) - .event(event::mock().with_fields(field::mock("awaiting").with_value(&true))) - .exit(span::mock().named("test_async_fn")) - .enter(span::mock().named("test_async_fn")) - .exit(span::mock().named("test_async_fn")) - .enter(span::mock().named("test_async_fn")) - .exit(span::mock().named("test_async_fn")) - .drop_span(span::mock().named("test_async_fn")) - .done() + .new_span(expect::span().named("test_async_fn")) + .enter(expect::span().named("test_async_fn")) + .event(expect::event().with_fields(expect::field("awaiting").with_value(&true))) + .exit(expect::span().named("test_async_fn")) + .enter(expect::span().named("test_async_fn")) + .exit(expect::span().named("test_async_fn")) + .enter(expect::span().named("test_async_fn")) + .exit(expect::span().named("test_async_fn")) + .drop_span(expect::span().named("test_async_fn")) + .only() .run_with_handle(); with_default(subscriber, || { block_on_future(async { test_async_fn(2).await }).unwrap(); @@ -113,14 +112,14 @@ fn async_fn_nested() { tracing::trace!(nested = true); } - let span = span::mock().named("test_async_fns_nested"); - let span2 = span::mock().named("test_async_fns_nested_other"); + let span = expect::span().named("test_async_fns_nested"); + let span2 = expect::span().named("test_async_fns_nested_other"); let (subscriber, handle) = subscriber::mock() .new_span(span.clone()) .enter(span.clone()) .new_span(span2.clone()) .enter(span2.clone()) - .event(event::mock().with_fields(field::mock("nested").with_value(&true))) + .event(expect::event().with_fields(expect::field("nested").with_value(&true))) .exit(span2.clone()) .enter(span2.clone()) .exit(span2.clone()) @@ -129,7 +128,7 @@ fn async_fn_nested() { .enter(span.clone()) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || { @@ -191,26 +190,26 @@ fn async_fn_with_async_trait() { } } - let span = span::mock().named("foo"); - let span2 = span::mock().named("bar"); - let span3 = span::mock().named("baz"); + let span = expect::span().named("foo"); + let span2 = expect::span().named("bar"); + let span3 = expect::span().named("baz"); let (subscriber, handle) = subscriber::mock() .new_span( span.clone() - .with_field(field::mock("self")) - .with_field(field::mock("v")), + .with_field(expect::field("self")) + .with_field(expect::field("v")), ) .enter(span.clone()) .new_span(span3.clone()) .enter(span3.clone()) - .event(event::mock().with_fields(field::mock("val").with_value(&2u64))) + .event(expect::event().with_fields(expect::field("val").with_value(&2u64))) .exit(span3.clone()) .enter(span3.clone()) .exit(span3.clone()) .drop_span(span3) - .new_span(span2.clone().with_field(field::mock("self"))) + .new_span(span2.clone().with_field(expect::field("self"))) .enter(span2.clone()) - .event(event::mock().with_fields(field::mock("val").with_value(&5u64))) + .event(expect::event().with_fields(expect::field("val").with_value(&5u64))) .exit(span2.clone()) .enter(span2.clone()) .exit(span2.clone()) @@ -219,7 +218,7 @@ fn async_fn_with_async_trait() { .enter(span.clone()) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || { @@ -255,15 +254,15 @@ fn async_fn_with_async_trait_and_fields_expressions() { async fn call(&mut self, _v: usize) {} } - let span = span::mock().named("call"); + let span = expect::span().named("call"); let (subscriber, handle) = subscriber::mock() .new_span( span.clone().with_field( - field::mock("_v") + expect::field("_v") .with_value(&5usize) - .and(field::mock("test").with_value(&tracing::field::debug(10))) - .and(field::mock("val").with_value(&42u64)) - .and(field::mock("val2").with_value(&42u64)), + .and(expect::field("test").with_value(&tracing::field::debug(10))) + .and(expect::field("val").with_value(&42u64)) + .and(expect::field("val2").with_value(&42u64)), ), ) .enter(span.clone()) @@ -271,7 +270,7 @@ fn async_fn_with_async_trait_and_fields_expressions() { .enter(span.clone()) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || { @@ -323,26 +322,26 @@ fn async_fn_with_async_trait_and_fields_expressions_with_generic_parameter() { } //let span = span::mock().named("call"); - let span2 = span::mock().named("call_with_self"); - let span3 = span::mock().named("call_with_mut_self"); - let span4 = span::mock().named("sync_fun"); + let span2 = expect::span().named("call_with_self"); + let span3 = expect::span().named("call_with_mut_self"); + let span4 = expect::span().named("sync_fun"); let (subscriber, handle) = subscriber::mock() /*.new_span(span.clone() .with_field( - field::mock("Self").with_value(&"TestImpler"))) + expect::field("Self").with_value(&"TestImpler"))) .enter(span.clone()) .exit(span.clone()) .drop_span(span)*/ .new_span( span2 .clone() - .with_field(field::mock("Self").with_value(&std::any::type_name::<TestImpl>())), + .with_field(expect::field("Self").with_value(&std::any::type_name::<TestImpl>())), ) .enter(span2.clone()) .new_span( span4 .clone() - .with_field(field::mock("Self").with_value(&std::any::type_name::<TestImpl>())), + .with_field(expect::field("Self").with_value(&std::any::type_name::<TestImpl>())), ) .enter(span4.clone()) .exit(span4.clone()) @@ -355,14 +354,14 @@ fn async_fn_with_async_trait_and_fields_expressions_with_generic_parameter() { .new_span( span3 .clone() - .with_field(field::mock("Self").with_value(&std::any::type_name::<TestImpl>())), + .with_field(expect::field("Self").with_value(&std::any::type_name::<TestImpl>())), ) .enter(span3.clone()) .exit(span3.clone()) .enter(span3.clone()) .exit(span3.clone()) .drop_span(span3) - .done() + .only() .run_with_handle(); with_default(subscriber, || { @@ -397,7 +396,7 @@ fn out_of_scope_fields() { } } - let span = span::mock().named("call"); + let span = expect::span().named("call"); let (subscriber, handle) = subscriber::mock() .new_span(span.clone()) .enter(span.clone()) @@ -405,7 +404,7 @@ fn out_of_scope_fields() { .enter(span.clone()) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || { @@ -430,8 +429,8 @@ fn manual_impl_future() { } } - let span = span::mock().named("manual_impl_future"); - let poll_event = || event::mock().with_fields(field::mock("poll").with_value(&true)); + let span = expect::span().named("manual_impl_future"); + let poll_event = || expect::event().with_fields(expect::field("poll").with_value(&true)); let (subscriber, handle) = subscriber::mock() // await manual_impl_future @@ -442,7 +441,7 @@ fn manual_impl_future() { .enter(span.clone()) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || { @@ -463,8 +462,8 @@ fn manual_box_pin() { }) } - let span = span::mock().named("manual_box_pin"); - let poll_event = || event::mock().with_fields(field::mock("poll").with_value(&true)); + let span = expect::span().named("manual_box_pin"); + let poll_event = || expect::event().with_fields(expect::field("poll").with_value(&true)); let (subscriber, handle) = subscriber::mock() // await manual_box_pin @@ -475,7 +474,7 @@ fn manual_box_pin() { .enter(span.clone()) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || { diff --git a/vendor/tracing-attributes/tests/destructuring.rs b/vendor/tracing-attributes/tests/destructuring.rs index 09cf1ad53..cc4fecf3f 100644 --- a/vendor/tracing-attributes/tests/destructuring.rs +++ b/vendor/tracing-attributes/tests/destructuring.rs @@ -7,21 +7,21 @@ fn destructure_tuples() { #[instrument] fn my_fn((arg1, arg2): (usize, usize)) {} - let span = span::mock().named("my_fn"); + let span = expect::span().named("my_fn"); let (subscriber, handle) = subscriber::mock() .new_span( span.clone().with_field( - field::mock("arg1") + expect::field("arg1") .with_value(&format_args!("1")) - .and(field::mock("arg2").with_value(&format_args!("2"))) + .and(expect::field("arg2").with_value(&format_args!("2"))) .only(), ), ) .enter(span.clone()) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || { @@ -36,23 +36,23 @@ fn destructure_nested_tuples() { #[instrument] fn my_fn(((arg1, arg2), (arg3, arg4)): ((usize, usize), (usize, usize))) {} - let span = span::mock().named("my_fn"); + let span = expect::span().named("my_fn"); let (subscriber, handle) = subscriber::mock() .new_span( span.clone().with_field( - field::mock("arg1") + expect::field("arg1") .with_value(&format_args!("1")) - .and(field::mock("arg2").with_value(&format_args!("2"))) - .and(field::mock("arg3").with_value(&format_args!("3"))) - .and(field::mock("arg4").with_value(&format_args!("4"))) + .and(expect::field("arg2").with_value(&format_args!("2"))) + .and(expect::field("arg3").with_value(&format_args!("3"))) + .and(expect::field("arg4").with_value(&format_args!("4"))) .only(), ), ) .enter(span.clone()) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || { @@ -67,17 +67,17 @@ fn destructure_refs() { #[instrument] fn my_fn(&arg1: &usize) {} - let span = span::mock().named("my_fn"); + let span = expect::span().named("my_fn"); let (subscriber, handle) = subscriber::mock() .new_span( span.clone() - .with_field(field::mock("arg1").with_value(&1usize).only()), + .with_field(expect::field("arg1").with_value(&1usize).only()), ) .enter(span.clone()) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || { @@ -94,21 +94,21 @@ fn destructure_tuple_structs() { #[instrument] fn my_fn(Foo(arg1, arg2): Foo) {} - let span = span::mock().named("my_fn"); + let span = expect::span().named("my_fn"); let (subscriber, handle) = subscriber::mock() .new_span( span.clone().with_field( - field::mock("arg1") + expect::field("arg1") .with_value(&format_args!("1")) - .and(field::mock("arg2").with_value(&format_args!("2"))) + .and(expect::field("arg2").with_value(&format_args!("2"))) .only(), ), ) .enter(span.clone()) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || { @@ -135,21 +135,21 @@ fn destructure_structs() { let _ = (arg1, arg2); } - let span = span::mock().named("my_fn"); + let span = expect::span().named("my_fn"); let (subscriber, handle) = subscriber::mock() .new_span( span.clone().with_field( - field::mock("arg1") + expect::field("arg1") .with_value(&format_args!("1")) - .and(field::mock("arg2").with_value(&format_args!("2"))) + .and(expect::field("arg2").with_value(&format_args!("2"))) .only(), ), ) .enter(span.clone()) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || { @@ -180,23 +180,23 @@ fn destructure_everything() { let _ = (arg1, arg2, arg3, arg4); } - let span = span::mock().named("my_fn"); + let span = expect::span().named("my_fn"); let (subscriber, handle) = subscriber::mock() .new_span( span.clone().with_field( - field::mock("arg1") + expect::field("arg1") .with_value(&format_args!("1")) - .and(field::mock("arg2").with_value(&format_args!("2"))) - .and(field::mock("arg3").with_value(&format_args!("3"))) - .and(field::mock("arg4").with_value(&format_args!("4"))) + .and(expect::field("arg2").with_value(&format_args!("2"))) + .and(expect::field("arg3").with_value(&format_args!("3"))) + .and(expect::field("arg4").with_value(&format_args!("4"))) .only(), ), ) .enter(span.clone()) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || { diff --git a/vendor/tracing-attributes/tests/err.rs b/vendor/tracing-attributes/tests/err.rs index 485dd1196..bee7aa5f4 100644 --- a/vendor/tracing-attributes/tests/err.rs +++ b/vendor/tracing-attributes/tests/err.rs @@ -21,20 +21,41 @@ fn err_suspicious_else() -> Result<u8, TryFromIntError> { #[test] fn test() { - let span = span::mock().named("err"); + let span = expect::span().named("err"); let (subscriber, handle) = subscriber::mock() .new_span(span.clone()) .enter(span.clone()) - .event(event::mock().at_level(Level::ERROR)) + .event(expect::event().at_level(Level::ERROR)) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || err().ok()); handle.assert_finished(); } #[instrument(err)] +fn err_early_return() -> Result<u8, TryFromIntError> { + u8::try_from(1234)?; + Ok(5) +} + +#[test] +fn test_early_return() { + let span = expect::span().named("err_early_return"); + let (subscriber, handle) = subscriber::mock() + .new_span(span.clone()) + .enter(span.clone()) + .event(expect::event().at_level(Level::ERROR)) + .exit(span.clone()) + .drop_span(span) + .only() + .run_with_handle(); + with_default(subscriber, || err_early_return().ok()); + handle.assert_finished(); +} + +#[instrument(err)] async fn err_async(polls: usize) -> Result<u8, TryFromIntError> { let future = PollN::new_ok(polls); tracing::trace!(awaiting = true); @@ -44,23 +65,23 @@ async fn err_async(polls: usize) -> Result<u8, TryFromIntError> { #[test] fn test_async() { - let span = span::mock().named("err_async"); + let span = expect::span().named("err_async"); let (subscriber, handle) = subscriber::mock() .new_span(span.clone()) .enter(span.clone()) .event( - event::mock() - .with_fields(field::mock("awaiting").with_value(&true)) + expect::event() + .with_fields(expect::field("awaiting").with_value(&true)) .at_level(Level::TRACE), ) .exit(span.clone()) .enter(span.clone()) - .event(event::mock().at_level(Level::ERROR)) + .event(expect::event().at_level(Level::ERROR)) .exit(span.clone()) .enter(span.clone()) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || { block_on_future(async { err_async(2).await }).ok(); @@ -76,14 +97,14 @@ fn err_mut(out: &mut u8) -> Result<(), TryFromIntError> { #[test] fn test_mut() { - let span = span::mock().named("err_mut"); + let span = expect::span().named("err_mut"); let (subscriber, handle) = subscriber::mock() .new_span(span.clone()) .enter(span.clone()) - .event(event::mock().at_level(Level::ERROR)) + .event(expect::event().at_level(Level::ERROR)) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || err_mut(&mut 0).ok()); handle.assert_finished(); @@ -100,23 +121,23 @@ async fn err_mut_async(polls: usize, out: &mut u8) -> Result<(), TryFromIntError #[test] fn test_mut_async() { - let span = span::mock().named("err_mut_async"); + let span = expect::span().named("err_mut_async"); let (subscriber, handle) = subscriber::mock() .new_span(span.clone()) .enter(span.clone()) .event( - event::mock() - .with_fields(field::mock("awaiting").with_value(&true)) + expect::event() + .with_fields(expect::field("awaiting").with_value(&true)) .at_level(Level::TRACE), ) .exit(span.clone()) .enter(span.clone()) - .event(event::mock().at_level(Level::ERROR)) + .event(expect::event().at_level(Level::ERROR)) .exit(span.clone()) .enter(span.clone()) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || { block_on_future(async { err_mut_async(2, &mut 0).await }).ok(); @@ -133,17 +154,17 @@ fn impl_trait_return_type() { Ok(0..x) } - let span = span::mock().named("returns_impl_trait"); + let span = expect::span().named("returns_impl_trait"); let (subscriber, handle) = subscriber::mock() .new_span( span.clone() - .with_field(field::mock("x").with_value(&10usize).only()), + .with_field(expect::field("x").with_value(&10usize).only()), ) .enter(span.clone()) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || { @@ -162,13 +183,13 @@ fn err_dbg() -> Result<u8, TryFromIntError> { #[test] fn test_err_dbg() { - let span = span::mock().named("err_dbg"); + let span = expect::span().named("err_dbg"); let (subscriber, handle) = subscriber::mock() .new_span(span.clone()) .enter(span.clone()) .event( - event::mock().at_level(Level::ERROR).with_fields( - field::mock("error") + expect::event().at_level(Level::ERROR).with_fields( + expect::field("error") // use the actual error value that will be emitted, so // that this test doesn't break if the standard library // changes the `fmt::Debug` output from the error type @@ -178,7 +199,7 @@ fn test_err_dbg() { ) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || err_dbg().ok()); handle.assert_finished(); @@ -186,20 +207,20 @@ fn test_err_dbg() { #[test] fn test_err_display_default() { - let span = span::mock().named("err"); + let span = expect::span().named("err"); let (subscriber, handle) = subscriber::mock() .new_span(span.clone()) .enter(span.clone()) .event( - event::mock().at_level(Level::ERROR).with_fields( - field::mock("error") + expect::event().at_level(Level::ERROR).with_fields( + expect::field("error") // by default, errors will be emitted with their display values .with_value(&tracing::field::display(u8::try_from(1234).unwrap_err())), ), ) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || err().ok()); handle.assert_finished(); @@ -208,19 +229,19 @@ fn test_err_display_default() { #[test] fn test_err_custom_target() { let filter: EnvFilter = "my_target=error".parse().expect("filter should parse"); - let span = span::mock().named("error_span").with_target("my_target"); + let span = expect::span().named("error_span").with_target("my_target"); let (subscriber, handle) = subscriber::mock() .new_span(span.clone()) .enter(span.clone()) .event( - event::mock() + expect::event() .at_level(Level::ERROR) .with_target("my_target"), ) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); let subscriber = subscriber.with(filter); @@ -243,14 +264,14 @@ fn err_info() -> Result<u8, TryFromIntError> { #[test] fn test_err_info() { - let span = span::mock().named("err_info"); + let span = expect::span().named("err_info"); let (subscriber, handle) = subscriber::mock() .new_span(span.clone()) .enter(span.clone()) - .event(event::mock().at_level(Level::INFO)) + .event(expect::event().at_level(Level::INFO)) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || err_info().ok()); handle.assert_finished(); @@ -263,13 +284,13 @@ fn err_dbg_info() -> Result<u8, TryFromIntError> { #[test] fn test_err_dbg_info() { - let span = span::mock().named("err_dbg_info"); + let span = expect::span().named("err_dbg_info"); let (subscriber, handle) = subscriber::mock() .new_span(span.clone()) .enter(span.clone()) .event( - event::mock().at_level(Level::INFO).with_fields( - field::mock("error") + expect::event().at_level(Level::INFO).with_fields( + expect::field("error") // use the actual error value that will be emitted, so // that this test doesn't break if the standard library // changes the `fmt::Debug` output from the error type @@ -279,7 +300,7 @@ fn test_err_dbg_info() { ) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || err_dbg_info().ok()); handle.assert_finished(); @@ -292,14 +313,14 @@ fn err_warn_info() -> Result<u8, TryFromIntError> { #[test] fn test_err_warn_info() { - let span = span::mock().named("err_warn_info").at_level(Level::WARN); + let span = expect::span().named("err_warn_info").at_level(Level::WARN); let (subscriber, handle) = subscriber::mock() .new_span(span.clone()) .enter(span.clone()) - .event(event::mock().at_level(Level::INFO)) + .event(expect::event().at_level(Level::INFO)) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || err_warn_info().ok()); handle.assert_finished(); diff --git a/vendor/tracing-attributes/tests/fields.rs b/vendor/tracing-attributes/tests/fields.rs index c178fbb3d..a3b23d7ac 100644 --- a/vendor/tracing-attributes/tests/fields.rs +++ b/vendor/tracing-attributes/tests/fields.rs @@ -1,8 +1,6 @@ use tracing::subscriber::with_default; use tracing_attributes::instrument; -use tracing_mock::field::mock; -use tracing_mock::span::NewSpan; -use tracing_mock::*; +use tracing_mock::{expect, span::NewSpan, subscriber}; #[instrument(fields(foo = "bar", dsa = true, num = 1))] fn fn_no_param() {} @@ -48,11 +46,11 @@ impl HasField { #[test] fn fields() { - let span = span::mock().with_field( - mock("foo") + let span = expect::span().with_field( + expect::field("foo") .with_value(&"bar") - .and(mock("dsa").with_value(&true)) - .and(mock("num").with_value(&1)) + .and(expect::field("dsa").with_value(&true)) + .and(expect::field("num").with_value(&1)) .only(), ); run_test(span, || { @@ -62,10 +60,10 @@ fn fields() { #[test] fn expr_field() { - let span = span::mock().with_field( - mock("s") + let span = expect::span().with_field( + expect::field("s") .with_value(&"hello world") - .and(mock("len").with_value(&"hello world".len())) + .and(expect::field("len").with_value(&"hello world".len())) .only(), ); run_test(span, || { @@ -75,11 +73,11 @@ fn expr_field() { #[test] fn two_expr_fields() { - let span = span::mock().with_field( - mock("s") + let span = expect::span().with_field( + expect::field("s") .with_value(&"hello world") - .and(mock("s.len").with_value(&"hello world".len())) - .and(mock("s.is_empty").with_value(&false)) + .and(expect::field("s.len").with_value(&"hello world".len())) + .and(expect::field("s.is_empty").with_value(&false)) .only(), ); run_test(span, || { @@ -89,19 +87,19 @@ fn two_expr_fields() { #[test] fn clashy_expr_field() { - let span = span::mock().with_field( + let span = expect::span().with_field( // Overriding the `s` field should record `s` as a `Display` value, // rather than as a `Debug` value. - mock("s") + expect::field("s") .with_value(&tracing::field::display("hello world")) - .and(mock("s.len").with_value(&"hello world".len())) + .and(expect::field("s.len").with_value(&"hello world".len())) .only(), ); run_test(span, || { fn_clashy_expr_field("hello world"); }); - let span = span::mock().with_field(mock("s").with_value(&"s").only()); + let span = expect::span().with_field(expect::field("s").with_value(&"s").only()); run_test(span, || { fn_clashy_expr_field2("hello world"); }); @@ -109,7 +107,8 @@ fn clashy_expr_field() { #[test] fn self_expr_field() { - let span = span::mock().with_field(mock("my_field").with_value(&"hello world").only()); + let span = + expect::span().with_field(expect::field("my_field").with_value(&"hello world").only()); run_test(span, || { let has_field = HasField { my_field: "hello world", @@ -120,10 +119,10 @@ fn self_expr_field() { #[test] fn parameters_with_fields() { - let span = span::mock().with_field( - mock("foo") + let span = expect::span().with_field( + expect::field("foo") .with_value(&"bar") - .and(mock("param").with_value(&1u32)) + .and(expect::field("param").with_value(&1u32)) .only(), ); run_test(span, || { @@ -133,7 +132,7 @@ fn parameters_with_fields() { #[test] fn empty_field() { - let span = span::mock().with_field(mock("foo").with_value(&"bar").only()); + let span = expect::span().with_field(expect::field("foo").with_value(&"bar").only()); run_test(span, || { fn_empty_field(); }); @@ -141,7 +140,7 @@ fn empty_field() { #[test] fn string_field() { - let span = span::mock().with_field(mock("s").with_value(&"hello world").only()); + let span = expect::span().with_field(expect::field("s").with_value(&"hello world").only()); run_test(span, || { fn_string(String::from("hello world")); }); @@ -150,9 +149,9 @@ fn string_field() { fn run_test<F: FnOnce() -> T, T>(span: NewSpan, fun: F) { let (subscriber, handle) = subscriber::mock() .new_span(span) - .enter(span::mock()) - .exit(span::mock()) - .done() + .enter(expect::span()) + .exit(expect::span()) + .only() .run_with_handle(); with_default(subscriber, fun); diff --git a/vendor/tracing-attributes/tests/follows_from.rs b/vendor/tracing-attributes/tests/follows_from.rs index a589409de..6b5526b82 100644 --- a/vendor/tracing-attributes/tests/follows_from.rs +++ b/vendor/tracing-attributes/tests/follows_from.rs @@ -13,10 +13,10 @@ fn follows_from_current() {} #[test] fn follows_from_sync_test() { - let cause_a = span::mock().named("cause_a"); - let cause_b = span::mock().named("cause_b"); - let cause_c = span::mock().named("cause_c"); - let consequence = span::mock().named("with_follows_from_sync"); + let cause_a = expect::span().named("cause_a"); + let cause_b = expect::span().named("cause_b"); + let cause_c = expect::span().named("cause_c"); + let consequence = expect::span().named("with_follows_from_sync"); let (subscriber, handle) = subscriber::mock() .new_span(cause_a.clone()) @@ -28,7 +28,7 @@ fn follows_from_sync_test() { .follows_from(consequence.clone(), cause_c) .enter(consequence.clone()) .exit(consequence) - .done() + .only() .run_with_handle(); with_default(subscriber, || { @@ -44,10 +44,10 @@ fn follows_from_sync_test() { #[test] fn follows_from_async_test() { - let cause_a = span::mock().named("cause_a"); - let cause_b = span::mock().named("cause_b"); - let cause_c = span::mock().named("cause_c"); - let consequence = span::mock().named("with_follows_from_async"); + let cause_a = expect::span().named("cause_a"); + let cause_b = expect::span().named("cause_b"); + let cause_c = expect::span().named("cause_c"); + let consequence = expect::span().named("with_follows_from_async"); let (subscriber, handle) = subscriber::mock() .new_span(cause_a.clone()) @@ -61,7 +61,7 @@ fn follows_from_async_test() { .exit(consequence.clone()) .enter(consequence.clone()) .exit(consequence) - .done() + .only() .run_with_handle(); with_default(subscriber, || { @@ -79,8 +79,8 @@ fn follows_from_async_test() { #[test] fn follows_from_current_test() { - let cause = span::mock().named("cause"); - let consequence = span::mock().named("follows_from_current"); + let cause = expect::span().named("cause"); + let consequence = expect::span().named("follows_from_current"); let (subscriber, handle) = subscriber::mock() .new_span(cause.clone()) @@ -90,7 +90,7 @@ fn follows_from_current_test() { .enter(consequence.clone()) .exit(consequence) .exit(cause) - .done() + .only() .run_with_handle(); with_default(subscriber, || { diff --git a/vendor/tracing-attributes/tests/instrument.rs b/vendor/tracing-attributes/tests/instrument.rs index b215b8455..f751eebf6 100644 --- a/vendor/tracing-attributes/tests/instrument.rs +++ b/vendor/tracing-attributes/tests/instrument.rs @@ -20,11 +20,11 @@ fn override_everything() { #[instrument(level = Level::DEBUG, target = "my_target")] fn my_other_fn() {} - let span = span::mock() + let span = expect::span() .named("my_fn") .at_level(Level::DEBUG) .with_target("my_target"); - let span2 = span::mock() + let span2 = expect::span() .named("my_other_fn") .at_level(Level::DEBUG) .with_target("my_target"); @@ -37,7 +37,7 @@ fn override_everything() { .enter(span2.clone()) .exit(span2.clone()) .drop_span(span2) - .done() + .only() .run_with_handle(); with_default(subscriber, || { @@ -53,21 +53,21 @@ fn fields() { #[instrument(target = "my_target", level = "debug")] fn my_fn(arg1: usize, arg2: bool) {} - let span = span::mock() + let span = expect::span() .named("my_fn") .at_level(Level::DEBUG) .with_target("my_target"); - let span2 = span::mock() + let span2 = expect::span() .named("my_fn") .at_level(Level::DEBUG) .with_target("my_target"); let (subscriber, handle) = subscriber::mock() .new_span( span.clone().with_field( - field::mock("arg1") + expect::field("arg1") .with_value(&2usize) - .and(field::mock("arg2").with_value(&false)) + .and(expect::field("arg2").with_value(&false)) .only(), ), ) @@ -76,16 +76,16 @@ fn fields() { .drop_span(span) .new_span( span2.clone().with_field( - field::mock("arg1") + expect::field("arg1") .with_value(&3usize) - .and(field::mock("arg2").with_value(&true)) + .and(expect::field("arg2").with_value(&true)) .only(), ), ) .enter(span2.clone()) .exit(span2.clone()) .drop_span(span2) - .done() + .only() .run_with_handle(); with_default(subscriber, || { @@ -106,17 +106,17 @@ fn skip() { #[instrument(target = "my_target", level = "debug", skip_all)] fn my_fn2(_arg1: usize, _arg2: UnDebug, _arg3: UnDebug) {} - let span = span::mock() + let span = expect::span() .named("my_fn") .at_level(Level::DEBUG) .with_target("my_target"); - let span2 = span::mock() + let span2 = expect::span() .named("my_fn") .at_level(Level::DEBUG) .with_target("my_target"); - let span3 = span::mock() + let span3 = expect::span() .named("my_fn2") .at_level(Level::DEBUG) .with_target("my_target"); @@ -124,7 +124,7 @@ fn skip() { let (subscriber, handle) = subscriber::mock() .new_span( span.clone() - .with_field(field::mock("arg1").with_value(&2usize).only()), + .with_field(expect::field("arg1").with_value(&2usize).only()), ) .enter(span.clone()) .exit(span.clone()) @@ -132,7 +132,7 @@ fn skip() { .new_span( span2 .clone() - .with_field(field::mock("arg1").with_value(&3usize).only()), + .with_field(expect::field("arg1").with_value(&3usize).only()), ) .enter(span2.clone()) .exit(span2.clone()) @@ -141,7 +141,7 @@ fn skip() { .enter(span3.clone()) .exit(span3.clone()) .drop_span(span3) - .done() + .only() .run_with_handle(); with_default(subscriber, || { @@ -165,20 +165,20 @@ fn generics() { { } - let span = span::mock().named("my_fn"); + let span = expect::span().named("my_fn"); let (subscriber, handle) = subscriber::mock() .new_span( span.clone().with_field( - field::mock("arg1") + expect::field("arg1") .with_value(&format_args!("Foo")) - .and(field::mock("arg2").with_value(&format_args!("false"))), + .and(expect::field("arg2").with_value(&format_args!("false"))), ), ) .enter(span.clone()) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || { @@ -198,20 +198,20 @@ fn methods() { fn my_fn(&self, arg1: usize) {} } - let span = span::mock().named("my_fn"); + let span = expect::span().named("my_fn"); let (subscriber, handle) = subscriber::mock() .new_span( span.clone().with_field( - field::mock("self") + expect::field("self") .with_value(&format_args!("Foo")) - .and(field::mock("arg1").with_value(&42usize)), + .and(expect::field("arg1").with_value(&42usize)), ), ) .enter(span.clone()) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || { @@ -229,17 +229,17 @@ fn impl_trait_return_type() { 0..x } - let span = span::mock().named("returns_impl_trait"); + let span = expect::span().named("returns_impl_trait"); let (subscriber, handle) = subscriber::mock() .new_span( span.clone() - .with_field(field::mock("x").with_value(&10usize).only()), + .with_field(expect::field("x").with_value(&10usize).only()), ) .enter(span.clone()) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || { diff --git a/vendor/tracing-attributes/tests/levels.rs b/vendor/tracing-attributes/tests/levels.rs index 94fc7e85a..ed80dc16a 100644 --- a/vendor/tracing-attributes/tests/levels.rs +++ b/vendor/tracing-attributes/tests/levels.rs @@ -20,22 +20,22 @@ fn named_levels() { #[instrument(level = "eRrOr")] fn error() {} let (subscriber, handle) = subscriber::mock() - .new_span(span::mock().named("trace").at_level(Level::TRACE)) - .enter(span::mock().named("trace").at_level(Level::TRACE)) - .exit(span::mock().named("trace").at_level(Level::TRACE)) - .new_span(span::mock().named("debug").at_level(Level::DEBUG)) - .enter(span::mock().named("debug").at_level(Level::DEBUG)) - .exit(span::mock().named("debug").at_level(Level::DEBUG)) - .new_span(span::mock().named("info").at_level(Level::INFO)) - .enter(span::mock().named("info").at_level(Level::INFO)) - .exit(span::mock().named("info").at_level(Level::INFO)) - .new_span(span::mock().named("warn").at_level(Level::WARN)) - .enter(span::mock().named("warn").at_level(Level::WARN)) - .exit(span::mock().named("warn").at_level(Level::WARN)) - .new_span(span::mock().named("error").at_level(Level::ERROR)) - .enter(span::mock().named("error").at_level(Level::ERROR)) - .exit(span::mock().named("error").at_level(Level::ERROR)) - .done() + .new_span(expect::span().named("trace").at_level(Level::TRACE)) + .enter(expect::span().named("trace").at_level(Level::TRACE)) + .exit(expect::span().named("trace").at_level(Level::TRACE)) + .new_span(expect::span().named("debug").at_level(Level::DEBUG)) + .enter(expect::span().named("debug").at_level(Level::DEBUG)) + .exit(expect::span().named("debug").at_level(Level::DEBUG)) + .new_span(expect::span().named("info").at_level(Level::INFO)) + .enter(expect::span().named("info").at_level(Level::INFO)) + .exit(expect::span().named("info").at_level(Level::INFO)) + .new_span(expect::span().named("warn").at_level(Level::WARN)) + .enter(expect::span().named("warn").at_level(Level::WARN)) + .exit(expect::span().named("warn").at_level(Level::WARN)) + .new_span(expect::span().named("error").at_level(Level::ERROR)) + .enter(expect::span().named("error").at_level(Level::ERROR)) + .exit(expect::span().named("error").at_level(Level::ERROR)) + .only() .run_with_handle(); with_default(subscriber, || { @@ -66,22 +66,22 @@ fn numeric_levels() { #[instrument(level = 5)] fn error() {} let (subscriber, handle) = subscriber::mock() - .new_span(span::mock().named("trace").at_level(Level::TRACE)) - .enter(span::mock().named("trace").at_level(Level::TRACE)) - .exit(span::mock().named("trace").at_level(Level::TRACE)) - .new_span(span::mock().named("debug").at_level(Level::DEBUG)) - .enter(span::mock().named("debug").at_level(Level::DEBUG)) - .exit(span::mock().named("debug").at_level(Level::DEBUG)) - .new_span(span::mock().named("info").at_level(Level::INFO)) - .enter(span::mock().named("info").at_level(Level::INFO)) - .exit(span::mock().named("info").at_level(Level::INFO)) - .new_span(span::mock().named("warn").at_level(Level::WARN)) - .enter(span::mock().named("warn").at_level(Level::WARN)) - .exit(span::mock().named("warn").at_level(Level::WARN)) - .new_span(span::mock().named("error").at_level(Level::ERROR)) - .enter(span::mock().named("error").at_level(Level::ERROR)) - .exit(span::mock().named("error").at_level(Level::ERROR)) - .done() + .new_span(expect::span().named("trace").at_level(Level::TRACE)) + .enter(expect::span().named("trace").at_level(Level::TRACE)) + .exit(expect::span().named("trace").at_level(Level::TRACE)) + .new_span(expect::span().named("debug").at_level(Level::DEBUG)) + .enter(expect::span().named("debug").at_level(Level::DEBUG)) + .exit(expect::span().named("debug").at_level(Level::DEBUG)) + .new_span(expect::span().named("info").at_level(Level::INFO)) + .enter(expect::span().named("info").at_level(Level::INFO)) + .exit(expect::span().named("info").at_level(Level::INFO)) + .new_span(expect::span().named("warn").at_level(Level::WARN)) + .enter(expect::span().named("warn").at_level(Level::WARN)) + .exit(expect::span().named("warn").at_level(Level::WARN)) + .new_span(expect::span().named("error").at_level(Level::ERROR)) + .enter(expect::span().named("error").at_level(Level::ERROR)) + .exit(expect::span().named("error").at_level(Level::ERROR)) + .only() .run_with_handle(); with_default(subscriber, || { @@ -112,22 +112,22 @@ fn enum_levels() { #[instrument(level = Level::ERROR)] fn error() {} let (subscriber, handle) = subscriber::mock() - .new_span(span::mock().named("trace").at_level(Level::TRACE)) - .enter(span::mock().named("trace").at_level(Level::TRACE)) - .exit(span::mock().named("trace").at_level(Level::TRACE)) - .new_span(span::mock().named("debug").at_level(Level::DEBUG)) - .enter(span::mock().named("debug").at_level(Level::DEBUG)) - .exit(span::mock().named("debug").at_level(Level::DEBUG)) - .new_span(span::mock().named("info").at_level(Level::INFO)) - .enter(span::mock().named("info").at_level(Level::INFO)) - .exit(span::mock().named("info").at_level(Level::INFO)) - .new_span(span::mock().named("warn").at_level(Level::WARN)) - .enter(span::mock().named("warn").at_level(Level::WARN)) - .exit(span::mock().named("warn").at_level(Level::WARN)) - .new_span(span::mock().named("error").at_level(Level::ERROR)) - .enter(span::mock().named("error").at_level(Level::ERROR)) - .exit(span::mock().named("error").at_level(Level::ERROR)) - .done() + .new_span(expect::span().named("trace").at_level(Level::TRACE)) + .enter(expect::span().named("trace").at_level(Level::TRACE)) + .exit(expect::span().named("trace").at_level(Level::TRACE)) + .new_span(expect::span().named("debug").at_level(Level::DEBUG)) + .enter(expect::span().named("debug").at_level(Level::DEBUG)) + .exit(expect::span().named("debug").at_level(Level::DEBUG)) + .new_span(expect::span().named("info").at_level(Level::INFO)) + .enter(expect::span().named("info").at_level(Level::INFO)) + .exit(expect::span().named("info").at_level(Level::INFO)) + .new_span(expect::span().named("warn").at_level(Level::WARN)) + .enter(expect::span().named("warn").at_level(Level::WARN)) + .exit(expect::span().named("warn").at_level(Level::WARN)) + .new_span(expect::span().named("error").at_level(Level::ERROR)) + .enter(expect::span().named("error").at_level(Level::ERROR)) + .exit(expect::span().named("error").at_level(Level::ERROR)) + .only() .run_with_handle(); with_default(subscriber, || { diff --git a/vendor/tracing-attributes/tests/names.rs b/vendor/tracing-attributes/tests/names.rs index d97dece9a..03e3dbfa4 100644 --- a/vendor/tracing-attributes/tests/names.rs +++ b/vendor/tracing-attributes/tests/names.rs @@ -17,10 +17,10 @@ fn custom_name_no_equals() {} #[test] fn default_name_test() { let (subscriber, handle) = subscriber::mock() - .new_span(span::mock().named("default_name")) - .enter(span::mock().named("default_name")) - .exit(span::mock().named("default_name")) - .done() + .new_span(expect::span().named("default_name")) + .enter(expect::span().named("default_name")) + .exit(expect::span().named("default_name")) + .only() .run_with_handle(); with_default(subscriber, || { @@ -33,10 +33,10 @@ fn default_name_test() { #[test] fn custom_name_test() { let (subscriber, handle) = subscriber::mock() - .new_span(span::mock().named("my_name")) - .enter(span::mock().named("my_name")) - .exit(span::mock().named("my_name")) - .done() + .new_span(expect::span().named("my_name")) + .enter(expect::span().named("my_name")) + .exit(expect::span().named("my_name")) + .only() .run_with_handle(); with_default(subscriber, || { @@ -49,10 +49,10 @@ fn custom_name_test() { #[test] fn custom_name_no_equals_test() { let (subscriber, handle) = subscriber::mock() - .new_span(span::mock().named("my_other_name")) - .enter(span::mock().named("my_other_name")) - .exit(span::mock().named("my_other_name")) - .done() + .new_span(expect::span().named("my_other_name")) + .enter(expect::span().named("my_other_name")) + .exit(expect::span().named("my_other_name")) + .only() .run_with_handle(); with_default(subscriber, || { diff --git a/vendor/tracing-attributes/tests/parents.rs b/vendor/tracing-attributes/tests/parents.rs index 7069b98ea..d4559415d 100644 --- a/vendor/tracing-attributes/tests/parents.rs +++ b/vendor/tracing-attributes/tests/parents.rs @@ -14,8 +14,8 @@ where #[test] fn default_parent_test() { - let contextual_parent = span::mock().named("contextual_parent"); - let child = span::mock().named("with_default_parent"); + let contextual_parent = expect::span().named("contextual_parent"); + let child = expect::span().named("with_default_parent"); let (subscriber, handle) = subscriber::mock() .new_span( @@ -42,7 +42,7 @@ fn default_parent_test() { .enter(child.clone()) .exit(child) .exit(contextual_parent) - .done() + .only() .run_with_handle(); with_default(subscriber, || { @@ -60,9 +60,9 @@ fn default_parent_test() { #[test] fn explicit_parent_test() { - let contextual_parent = span::mock().named("contextual_parent"); - let explicit_parent = span::mock().named("explicit_parent"); - let child = span::mock().named("with_explicit_parent"); + let contextual_parent = expect::span().named("contextual_parent"); + let explicit_parent = expect::span().named("explicit_parent"); + let child = expect::span().named("with_explicit_parent"); let (subscriber, handle) = subscriber::mock() .new_span( @@ -86,7 +86,7 @@ fn explicit_parent_test() { .enter(child.clone()) .exit(child) .exit(contextual_parent) - .done() + .only() .run_with_handle(); with_default(subscriber, || { diff --git a/vendor/tracing-attributes/tests/ret.rs b/vendor/tracing-attributes/tests/ret.rs index f56c80baa..90bd9e185 100644 --- a/vendor/tracing-attributes/tests/ret.rs +++ b/vendor/tracing-attributes/tests/ret.rs @@ -19,18 +19,18 @@ fn ret_with_target() -> i32 { #[test] fn test() { - let span = span::mock().named("ret"); + let span = expect::span().named("ret"); let (subscriber, handle) = subscriber::mock() .new_span(span.clone()) .enter(span.clone()) .event( - event::mock() - .with_fields(field::mock("return").with_value(&tracing::field::debug(42))) + expect::event() + .with_fields(expect::field("return").with_value(&tracing::field::debug(42))) .at_level(Level::INFO), ) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, ret); @@ -40,7 +40,7 @@ fn test() { #[test] fn test_custom_target() { let filter: EnvFilter = "my_target=info".parse().expect("filter should parse"); - let span = span::mock() + let span = expect::span() .named("ret_with_target") .with_target("my_target"); @@ -48,14 +48,14 @@ fn test_custom_target() { .new_span(span.clone()) .enter(span.clone()) .event( - event::mock() - .with_fields(field::mock("return").with_value(&tracing::field::debug(42))) + expect::event() + .with_fields(expect::field("return").with_value(&tracing::field::debug(42))) .at_level(Level::INFO) .with_target("my_target"), ) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); let subscriber = subscriber.with(filter); @@ -71,18 +71,18 @@ fn ret_warn() -> i32 { #[test] fn test_warn() { - let span = span::mock().named("ret_warn"); + let span = expect::span().named("ret_warn"); let (subscriber, handle) = subscriber::mock() .new_span(span.clone()) .enter(span.clone()) .event( - event::mock() - .with_fields(field::mock("return").with_value(&tracing::field::debug(42))) + expect::event() + .with_fields(expect::field("return").with_value(&tracing::field::debug(42))) .at_level(Level::WARN), ) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, ret_warn); @@ -98,23 +98,23 @@ fn ret_mut(a: &mut i32) -> i32 { #[test] fn test_mut() { - let span = span::mock().named("ret_mut"); + let span = expect::span().named("ret_mut"); let (subscriber, handle) = subscriber::mock() .new_span(span.clone()) .enter(span.clone()) .event( - event::mock() - .with_fields(field::mock("a").with_value(&tracing::field::display(2))) + expect::event() + .with_fields(expect::field("a").with_value(&tracing::field::display(2))) .at_level(Level::INFO), ) .event( - event::mock() - .with_fields(field::mock("return").with_value(&tracing::field::debug(2))) + expect::event() + .with_fields(expect::field("return").with_value(&tracing::field::debug(2))) .at_level(Level::INFO), ) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || ret_mut(&mut 1)); @@ -128,20 +128,20 @@ async fn ret_async() -> i32 { #[test] fn test_async() { - let span = span::mock().named("ret_async"); + let span = expect::span().named("ret_async"); let (subscriber, handle) = subscriber::mock() .new_span(span.clone()) .enter(span.clone()) .event( - event::mock() - .with_fields(field::mock("return").with_value(&tracing::field::debug(42))) + expect::event() + .with_fields(expect::field("return").with_value(&tracing::field::debug(42))) .at_level(Level::INFO), ) .exit(span.clone()) .enter(span.clone()) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || block_on_future(async { ret_async().await })); @@ -155,18 +155,18 @@ fn ret_impl_type() -> impl Copy { #[test] fn test_impl_type() { - let span = span::mock().named("ret_impl_type"); + let span = expect::span().named("ret_impl_type"); let (subscriber, handle) = subscriber::mock() .new_span(span.clone()) .enter(span.clone()) .event( - event::mock() - .with_fields(field::mock("return").with_value(&tracing::field::debug(42))) + expect::event() + .with_fields(expect::field("return").with_value(&tracing::field::debug(42))) .at_level(Level::INFO), ) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, ret_impl_type); @@ -180,18 +180,18 @@ fn ret_display() -> i32 { #[test] fn test_dbg() { - let span = span::mock().named("ret_display"); + let span = expect::span().named("ret_display"); let (subscriber, handle) = subscriber::mock() .new_span(span.clone()) .enter(span.clone()) .event( - event::mock() - .with_fields(field::mock("return").with_value(&tracing::field::display(42))) + expect::event() + .with_fields(expect::field("return").with_value(&tracing::field::display(42))) .at_level(Level::INFO), ) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, ret_display); @@ -205,14 +205,14 @@ fn ret_and_err() -> Result<u8, TryFromIntError> { #[test] fn test_ret_and_err() { - let span = span::mock().named("ret_and_err"); + let span = expect::span().named("ret_and_err"); let (subscriber, handle) = subscriber::mock() .new_span(span.clone()) .enter(span.clone()) .event( - event::mock() + expect::event() .with_fields( - field::mock("error") + expect::field("error") .with_value(&tracing::field::display(u8::try_from(1234).unwrap_err())) .only(), ) @@ -220,7 +220,7 @@ fn test_ret_and_err() { ) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || ret_and_err().ok()); @@ -234,14 +234,14 @@ fn ret_and_ok() -> Result<u8, TryFromIntError> { #[test] fn test_ret_and_ok() { - let span = span::mock().named("ret_and_ok"); + let span = expect::span().named("ret_and_ok"); let (subscriber, handle) = subscriber::mock() .new_span(span.clone()) .enter(span.clone()) .event( - event::mock() + expect::event() .with_fields( - field::mock("return") + expect::field("return") .with_value(&tracing::field::debug(u8::try_from(123).unwrap())) .only(), ) @@ -249,7 +249,7 @@ fn test_ret_and_ok() { ) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, || ret_and_ok().ok()); @@ -263,18 +263,18 @@ fn ret_warn_info() -> i32 { #[test] fn test_warn_info() { - let span = span::mock().named("ret_warn_info").at_level(Level::WARN); + let span = expect::span().named("ret_warn_info").at_level(Level::WARN); let (subscriber, handle) = subscriber::mock() .new_span(span.clone()) .enter(span.clone()) .event( - event::mock() - .with_fields(field::mock("return").with_value(&tracing::field::debug(42))) + expect::event() + .with_fields(expect::field("return").with_value(&tracing::field::debug(42))) .at_level(Level::INFO), ) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, ret_warn_info); @@ -288,18 +288,18 @@ fn ret_dbg_warn() -> i32 { #[test] fn test_dbg_warn() { - let span = span::mock().named("ret_dbg_warn").at_level(Level::INFO); + let span = expect::span().named("ret_dbg_warn").at_level(Level::INFO); let (subscriber, handle) = subscriber::mock() .new_span(span.clone()) .enter(span.clone()) .event( - event::mock() - .with_fields(field::mock("return").with_value(&tracing::field::debug(42))) + expect::event() + .with_fields(expect::field("return").with_value(&tracing::field::debug(42))) .at_level(Level::WARN), ) .exit(span.clone()) .drop_span(span) - .done() + .only() .run_with_handle(); with_default(subscriber, ret_dbg_warn); diff --git a/vendor/tracing-attributes/tests/targets.rs b/vendor/tracing-attributes/tests/targets.rs index 363f628f3..0e70287d3 100644 --- a/vendor/tracing-attributes/tests/targets.rs +++ b/vendor/tracing-attributes/tests/targets.rs @@ -24,36 +24,36 @@ mod my_mod { fn default_targets() { let (subscriber, handle) = subscriber::mock() .new_span( - span::mock() + expect::span() .named("default_target") .with_target(module_path!()), ) .enter( - span::mock() + expect::span() .named("default_target") .with_target(module_path!()), ) .exit( - span::mock() + expect::span() .named("default_target") .with_target(module_path!()), ) .new_span( - span::mock() + expect::span() .named("default_target") .with_target(my_mod::MODULE_PATH), ) .enter( - span::mock() + expect::span() .named("default_target") .with_target(my_mod::MODULE_PATH), ) .exit( - span::mock() + expect::span() .named("default_target") .with_target(my_mod::MODULE_PATH), ) - .done() + .only() .run_with_handle(); with_default(subscriber, || { @@ -67,25 +67,37 @@ fn default_targets() { #[test] fn custom_targets() { let (subscriber, handle) = subscriber::mock() - .new_span(span::mock().named("custom_target").with_target("my_target")) - .enter(span::mock().named("custom_target").with_target("my_target")) - .exit(span::mock().named("custom_target").with_target("my_target")) .new_span( - span::mock() + expect::span() + .named("custom_target") + .with_target("my_target"), + ) + .enter( + expect::span() + .named("custom_target") + .with_target("my_target"), + ) + .exit( + expect::span() + .named("custom_target") + .with_target("my_target"), + ) + .new_span( + expect::span() .named("custom_target") .with_target("my_other_target"), ) .enter( - span::mock() + expect::span() .named("custom_target") .with_target("my_other_target"), ) .exit( - span::mock() + expect::span() .named("custom_target") .with_target("my_other_target"), ) - .done() + .only() .run_with_handle(); with_default(subscriber, || { |