Skip to content

Commit 5fb947f

Browse files
committed
Add test.
1 parent 4356e83 commit 5fb947f

File tree

1 file changed

+6
-0
lines changed
  • library/coretests/tests/fmt

1 file changed

+6
-0
lines changed

library/coretests/tests/fmt/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ fn test_lifetime() {
1212
let a = format_args!("hello {a} {a:?}");
1313
assert_eq!(a.to_string(), "hello hello hello hello hello hello hello");
1414

15+
// Check that temporaries as arguments are extended.
16+
let b = format_args!("{}", String::new());
17+
let c = format_args!("{}{}", String::new(), String::new());
18+
assert_eq!(b.to_string(), "");
19+
assert_eq!(c.to_string(), "");
20+
1521
// Without arguments, it should also work in consts.
1622
const A: std::fmt::Arguments<'static> = format_args!("hello");
1723
assert_eq!(A.to_string(), "hello");

0 commit comments

Comments
 (0)