@@ -106,16 +106,60 @@ fn literal_raw_string() {
106106 "r\" \r \n \" " . parse :: < TokenStream > ( ) . unwrap ( ) ;
107107}
108108
109+ #[ test]
110+ fn literal_byte_string ( ) {
111+ assert_eq ! ( Literal :: byte_string( b"" ) . to_string( ) , "b\" \" " ) ;
112+ assert_eq ! (
113+ Literal :: byte_string( b"\0 \t \n \r \" \\ 2\x10 " ) . to_string( ) ,
114+ "b\" \\ 0\\ t\\ n\\ r\\ \" \\ \\ 2\\ x10\" " ,
115+ ) ;
116+ }
117+
109118#[ test]
110119fn literal_character ( ) {
111120 assert_eq ! ( Literal :: character( 'x' ) . to_string( ) , "'x'" ) ;
112121 assert_eq ! ( Literal :: character( '\'' ) . to_string( ) , "'\\ ''" ) ;
113122 assert_eq ! ( Literal :: character( '"' ) . to_string( ) , "'\" '" ) ;
114123}
115124
125+ #[ test]
126+ fn literal_integer ( ) {
127+ assert_eq ! ( Literal :: u8_suffixed( 10 ) . to_string( ) , "10u8" ) ;
128+ assert_eq ! ( Literal :: u16_suffixed( 10 ) . to_string( ) , "10u16" ) ;
129+ assert_eq ! ( Literal :: u32_suffixed( 10 ) . to_string( ) , "10u32" ) ;
130+ assert_eq ! ( Literal :: u64_suffixed( 10 ) . to_string( ) , "10u64" ) ;
131+ assert_eq ! ( Literal :: u128_suffixed( 10 ) . to_string( ) , "10u128" ) ;
132+ assert_eq ! ( Literal :: usize_suffixed( 10 ) . to_string( ) , "10usize" ) ;
133+
134+ assert_eq ! ( Literal :: i8_suffixed( 10 ) . to_string( ) , "10i8" ) ;
135+ assert_eq ! ( Literal :: i16_suffixed( 10 ) . to_string( ) , "10i16" ) ;
136+ assert_eq ! ( Literal :: i32_suffixed( 10 ) . to_string( ) , "10i32" ) ;
137+ assert_eq ! ( Literal :: i64_suffixed( 10 ) . to_string( ) , "10i64" ) ;
138+ assert_eq ! ( Literal :: i128_suffixed( 10 ) . to_string( ) , "10i128" ) ;
139+ assert_eq ! ( Literal :: isize_suffixed( 10 ) . to_string( ) , "10isize" ) ;
140+
141+ assert_eq ! ( Literal :: u8_unsuffixed( 10 ) . to_string( ) , "10" ) ;
142+ assert_eq ! ( Literal :: u16_unsuffixed( 10 ) . to_string( ) , "10" ) ;
143+ assert_eq ! ( Literal :: u32_unsuffixed( 10 ) . to_string( ) , "10" ) ;
144+ assert_eq ! ( Literal :: u64_unsuffixed( 10 ) . to_string( ) , "10" ) ;
145+ assert_eq ! ( Literal :: u128_unsuffixed( 10 ) . to_string( ) , "10" ) ;
146+ assert_eq ! ( Literal :: usize_unsuffixed( 10 ) . to_string( ) , "10" ) ;
147+
148+ assert_eq ! ( Literal :: i8_unsuffixed( 10 ) . to_string( ) , "10" ) ;
149+ assert_eq ! ( Literal :: i16_unsuffixed( 10 ) . to_string( ) , "10" ) ;
150+ assert_eq ! ( Literal :: i32_unsuffixed( 10 ) . to_string( ) , "10" ) ;
151+ assert_eq ! ( Literal :: i64_unsuffixed( 10 ) . to_string( ) , "10" ) ;
152+ assert_eq ! ( Literal :: i128_unsuffixed( 10 ) . to_string( ) , "10" ) ;
153+ assert_eq ! ( Literal :: isize_unsuffixed( 10 ) . to_string( ) , "10" ) ;
154+ }
155+
116156#[ test]
117157fn literal_float ( ) {
158+ assert_eq ! ( Literal :: f32_suffixed( 10.0 ) . to_string( ) , "10f32" ) ;
159+ assert_eq ! ( Literal :: f64_suffixed( 10.0 ) . to_string( ) , "10f64" ) ;
160+
118161 assert_eq ! ( Literal :: f32_unsuffixed( 10.0 ) . to_string( ) , "10.0" ) ;
162+ assert_eq ! ( Literal :: f64_unsuffixed( 10.0 ) . to_string( ) , "10.0" ) ;
119163}
120164
121165#[ test]
0 commit comments