Skip to content

Commit

Permalink
tests: add level! tests for events with const names
Browse files Browse the repository at this point in the history
  • Loading branch information
mladedav committed Feb 18, 2024
1 parent 4925fcf commit fb9e717
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion tracing/tests/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,12 +555,15 @@ fn trace() {
trace!(foo = ?3, bar.baz = %2, quux = false);
trace!(foo = 3, bar.baz = 2, quux = false);
trace!(foo = 3, bar.baz = 3,);
trace!("foo" = 3, bar.baz = 3,);
trace!(foo = 3, "bar.baz" = 3,);
trace!("foo");
trace!("foo: {}", 3);
trace!(foo = ?3, bar.baz = %2, quux = false, "hello world {:?}", 42);
trace!(foo = 3, bar.baz = 2, quux = false, "hello world {:?}", 42);
trace!(foo = 3, bar.baz = 3, "hello world {:?}", 42,);
trace!({ foo = 3, bar.baz = 80 }, "quux");
trace!({ "foo" = 3, "bar.baz" = 80 }, "quux");
trace!({ foo = 2, bar.baz = 79 }, "quux {:?}", true);
trace!({ foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
trace!({ foo = 2, bar.baz = 78 }, "quux");
Expand All @@ -579,6 +582,9 @@ fn trace() {
trace!(?foo);
trace!(%foo);
trace!(foo);
trace!("foo" = ?foo);
trace!("foo" = %foo);
trace!("foo" = foo);
trace!(name: "foo", ?foo);
trace!(name: "foo", %foo);
trace!(name: "foo", foo);
Expand Down Expand Up @@ -615,12 +621,15 @@ fn debug() {
debug!(foo = ?3, bar.baz = %2, quux = false);
debug!(foo = 3, bar.baz = 2, quux = false);
debug!(foo = 3, bar.baz = 3,);
debug!("foo" = 3, bar.baz = 3,);
debug!(foo = 3, "bar.baz" = 3,);
debug!("foo");
debug!("foo: {}", 3);
debug!(foo = ?3, bar.baz = %2, quux = false, "hello world {:?}", 42);
debug!(foo = 3, bar.baz = 2, quux = false, "hello world {:?}", 42);
debug!(foo = 3, bar.baz = 3, "hello world {:?}", 42,);
debug!({ foo = 3, bar.baz = 80 }, "quux");
debug!({ "foo" = 3, "bar.baz" = 80 }, "quux");
debug!({ foo = 2, bar.baz = 79 }, "quux {:?}", true);
debug!({ foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
debug!({ foo = 2, bar.baz = 78 }, "quux");
Expand All @@ -639,6 +648,9 @@ fn debug() {
debug!(?foo);
debug!(%foo);
debug!(foo);
debug!("foo" = ?foo);
debug!("foo" = %foo);
debug!("foo" = foo);
debug!(name: "foo", ?foo);
debug!(name: "foo", %foo);
debug!(name: "foo", foo);
Expand Down Expand Up @@ -675,12 +687,15 @@ fn info() {
info!(foo = ?3, bar.baz = %2, quux = false);
info!(foo = 3, bar.baz = 2, quux = false);
info!(foo = 3, bar.baz = 3,);
info!("foo" = 3, bar.baz = 3,);
info!(foo = 3, "bar.baz" = 3,);
info!("foo");
info!("foo: {}", 3);
info!(foo = ?3, bar.baz = %2, quux = false, "hello world {:?}", 42);
info!(foo = 3, bar.baz = 2, quux = false, "hello world {:?}", 42);
info!(foo = 3, bar.baz = 3, "hello world {:?}", 42,);
info!({ foo = 3, bar.baz = 80 }, "quux");
info!({ "foo" = 3, "bar.baz" = 80 }, "quux");
info!({ foo = 2, bar.baz = 79 }, "quux {:?}", true);
info!({ foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
info!({ foo = 2, bar.baz = 78 }, "quux");
Expand All @@ -699,6 +714,9 @@ fn info() {
info!(?foo);
info!(%foo);
info!(foo);
info!("foo" = ?foo);
info!("foo" = %foo);
info!("foo" = foo);
info!(name: "foo", ?foo);
info!(name: "foo", %foo);
info!(name: "foo", foo);
Expand Down Expand Up @@ -735,12 +753,15 @@ fn warn() {
warn!(foo = ?3, bar.baz = %2, quux = false);
warn!(foo = 3, bar.baz = 2, quux = false);
warn!(foo = 3, bar.baz = 3,);
warn!("foo" = 3, bar.baz = 3,);
warn!(foo = 3, "bar.baz" = 3,);
warn!("foo");
warn!("foo: {}", 3);
warn!(foo = ?3, bar.baz = %2, quux = false, "hello world {:?}", 42);
warn!(foo = 3, bar.baz = 2, quux = false, "hello world {:?}", 42);
warn!(foo = 3, bar.baz = 3, "hello world {:?}", 42,);
warn!({ foo = 3, bar.baz = 80 }, "quux");
warn!({ "foo" = 3, "bar.baz" = 80 }, "quux");
warn!({ foo = 2, bar.baz = 79 }, "quux {:?}", true);
warn!({ foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
warn!({ foo = 2, bar.baz = 78 }, "quux");
Expand All @@ -759,6 +780,9 @@ fn warn() {
warn!(?foo);
warn!(%foo);
warn!(foo);
warn!("foo" = ?foo);
warn!("foo" = %foo);
warn!("foo" = foo);
warn!(name: "foo", ?foo);
warn!(name: "foo", %foo);
warn!(name: "foo", foo);
Expand Down Expand Up @@ -795,15 +819,18 @@ fn error() {
error!(foo = ?3, bar.baz = %2, quux = false);
error!(foo = 3, bar.baz = 2, quux = false);
error!(foo = 3, bar.baz = 3,);
error!("foo" = 3, bar.baz = 3,);
error!(foo = 3, "bar.baz" = 3,);
error!("foo");
error!("foo: {}", 3);
error!(foo = ?3, bar.baz = %2, quux = false, "hello world {:?}", 42);
error!(foo = 3, bar.baz = 2, quux = false, "hello world {:?}", 42);
error!(foo = 3, bar.baz = 3, "hello world {:?}", 42,);
error!({ foo = 3, bar.baz = 80 }, "quux");
error!({ "foo" = 3, "bar.baz" = 80 }, "quux");
error!({ foo = 2, bar.baz = 79 }, "quux {:?}", true);
error!({ foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
error!({ foo = 2, bar.baz = 78, }, "quux");
error!({ foo = 2, bar.baz = 78 }, "quux");
error!({ foo = ?2, bar.baz = %78 }, "quux");
error!(name: "foo", foo = 3, bar.baz = 2, quux = false);
error!(name: "foo", target: "foo_events", foo = 3, bar.baz = 2, quux = false);
Expand All @@ -819,6 +846,9 @@ fn error() {
error!(?foo);
error!(%foo);
error!(foo);
error!("foo" = ?foo);
error!("foo" = %foo);
error!("foo" = foo);
error!(name: "foo", ?foo);
error!(name: "foo", %foo);
error!(name: "foo", foo);
Expand Down

0 comments on commit fb9e717

Please sign in to comment.