From 17d40c6057c88f4c432b0d7bac88e1b84cb7e67f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:03:36 +0200 Subject: Adding upstream version 1.65.0+dfsg1. Signed-off-by: Daniel Baumann --- vendor/tracing/tests/event.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'vendor/tracing/tests/event.rs') diff --git a/vendor/tracing/tests/event.rs b/vendor/tracing/tests/event.rs index ffb63c816..61df19ad3 100644 --- a/vendor/tracing/tests/event.rs +++ b/vendor/tracing/tests/event.rs @@ -474,3 +474,27 @@ fn option_ref_mut_values() { handle.assert_finished(); } + +#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)] +#[test] +fn string_field() { + let (subscriber, handle) = subscriber::mock() + .event(event::mock().with_fields(field::mock("my_string").with_value(&"hello").only())) + .event( + event::mock().with_fields(field::mock("my_string").with_value(&"hello world!").only()), + ) + .done() + .run_with_handle(); + with_default(subscriber, || { + let mut my_string = String::from("hello"); + + tracing::event!(Level::INFO, my_string); + + // the string is not moved by using it as a field! + my_string.push_str(" world!"); + + tracing::event!(Level::INFO, my_string); + }); + + handle.assert_finished(); +} -- cgit v1.2.3