@@ -59,10 +59,30 @@ fn path() {
59
59
check_prefix ( PrefixEntryPoint :: Path , "foo::<> baz" , "foo::<>" ) ;
60
60
check_prefix ( PrefixEntryPoint :: Path , "foo<> baz" , "foo<>" ) ;
61
61
check_prefix ( PrefixEntryPoint :: Path , "Fn() -> i32?" , "Fn() -> i32" ) ;
62
- // FIXME: this shouldn't be accepted as path actually.
62
+ // FIXME: This shouldn't be accepted as path actually.
63
63
check_prefix ( PrefixEntryPoint :: Path , "<_>::foo" , "<_>::foo" ) ;
64
64
}
65
65
66
+ #[ test]
67
+ fn item ( ) {
68
+ // FIXME: This shouldn't consume the semicolon.
69
+ check_prefix ( PrefixEntryPoint :: Item , "fn foo() {};" , "fn foo() {};" ) ;
70
+ check_prefix ( PrefixEntryPoint :: Item , "#[attr] pub struct S {} 92" , "#[attr] pub struct S {}" ) ;
71
+ check_prefix ( PrefixEntryPoint :: Item , "item!{}?" , "item!{}" ) ;
72
+ check_prefix ( PrefixEntryPoint :: Item , "????" , "?" ) ;
73
+ }
74
+
75
+ #[ test]
76
+ fn meta_item ( ) {
77
+ check_prefix ( PrefixEntryPoint :: MetaItem , "attr, " , "attr" ) ;
78
+ check_prefix (
79
+ PrefixEntryPoint :: MetaItem ,
80
+ "attr(some token {stream});" ,
81
+ "attr(some token {stream})" ,
82
+ ) ;
83
+ check_prefix ( PrefixEntryPoint :: MetaItem , "path::attr = 2 * 2!" , "path::attr = 2 * 2" ) ;
84
+ }
85
+
66
86
fn check_prefix ( entry : PrefixEntryPoint , input : & str , prefix : & str ) {
67
87
let lexed = LexedStr :: new ( input) ;
68
88
let input = lexed. to_input ( ) ;
0 commit comments