File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
library/coretests/tests/fmt Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,22 @@ mod builders;
2
2
mod float;
3
3
mod num;
4
4
5
+ #[ test]
6
+ #[ cfg( not( bootstrap) ) ]
7
+ fn test_lifetime ( ) {
8
+ // Trigger all different forms of expansion,
9
+ // and check that each of them can be stored as a variable.
10
+ let a = format_args ! ( "hello" ) ;
11
+ let a = format_args ! ( "hello {a}" ) ;
12
+ let a = format_args ! ( "hello {a:1}" ) ;
13
+ let a = format_args ! ( "hello {a} {a:?}" ) ;
14
+ assert_eq ! ( a. to_string( ) , "hello hello hello hello hello hello hello" ) ;
15
+
16
+ // Without arguments, it should also work in consts.
17
+ const A : std:: fmt:: Arguments < ' static > = format_args ! ( "hello" ) ;
18
+ assert_eq ! ( A . to_string( ) , "hello" ) ;
19
+ }
20
+
5
21
#[ test]
6
22
fn test_format_flags ( ) {
7
23
// No residual flags left by pointer formatting
You can’t perform that action at this time.
0 commit comments