File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -163,6 +163,20 @@ fn literal_iter_negative() {
163163 assert ! ( iter. next( ) . is_none( ) ) ;
164164}
165165
166+ #[ test]
167+ fn literal_parse ( ) {
168+ assert ! ( "1" . parse:: <Literal >( ) . is_ok( ) ) ;
169+ assert ! ( "1.0" . parse:: <Literal >( ) . is_ok( ) ) ;
170+ assert ! ( "'a'" . parse:: <Literal >( ) . is_ok( ) ) ;
171+ assert ! ( "\" \n \" " . parse:: <Literal >( ) . is_ok( ) ) ;
172+ assert ! ( "0 1" . parse:: <Literal >( ) . is_err( ) ) ;
173+ assert ! ( " 0" . parse:: <Literal >( ) . is_err( ) ) ;
174+ assert ! ( "0 " . parse:: <Literal >( ) . is_err( ) ) ;
175+ assert ! ( "/* comment */0" . parse:: <Literal >( ) . is_err( ) ) ;
176+ assert ! ( "0/* comment */" . parse:: <Literal >( ) . is_err( ) ) ;
177+ assert ! ( "0// comment" . parse:: <Literal >( ) . is_err( ) ) ;
178+ }
179+
166180#[ test]
167181fn roundtrip ( ) {
168182 fn roundtrip ( p : & str ) {
You can’t perform that action at this time.
0 commit comments