summaryrefslogtreecommitdiffstats
path: root/vendor/tracing/tests/event.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/tracing/tests/event.rs')
-rw-r--r--vendor/tracing/tests/event.rs24
1 files changed, 24 insertions, 0 deletions
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();
+}