-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from rerun-io/captured-identifiers-in-format-st…
…rings Support captured identifiers in format strings
- Loading branch information
Showing
9 changed files
with
86 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
//! Test that we can support capture identifiers in format strings introduced in Rust 1.58.0. | ||
//! See https://blog.rust-lang.org/2022/01/13/Rust-1.58.0.html#captured-identifiers-in-format-strings | ||
mod logger; | ||
|
||
#[test] | ||
fn info() { | ||
logger::init(); | ||
|
||
let value = "FOO"; | ||
|
||
for _ in 0..2 { | ||
log::info!("This is logged twice {value}!"); | ||
} | ||
|
||
for _ in 0..2 { | ||
log_once::info_once!("This is only logged once {value}!"); | ||
} | ||
|
||
for i in 0..2 { | ||
log_once::info_once!("This will be logged twice {i}!"); | ||
} | ||
|
||
let data = logger::logged_data(); | ||
let expected = "\ | ||
This is logged twice FOO! | ||
This is logged twice FOO! | ||
This is only logged once FOO! | ||
This will be logged twice 0! | ||
This will be logged twice 1! | ||
"; | ||
assert_eq!(data, expected); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters