Skip to content

Commit 0e5d888

Browse files
bors[bot]matklad
andauthored
Merge #11153
11153: internal: add more prefix entry point tests r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
2 parents 3f2edc7 + e36f557 commit 0e5d888

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

crates/parser/src/tests/entries.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,30 @@ fn path() {
5959
check_prefix(PrefixEntryPoint::Path, "foo::<> baz", "foo::<>");
6060
check_prefix(PrefixEntryPoint::Path, "foo<> baz", "foo<>");
6161
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.
6363
check_prefix(PrefixEntryPoint::Path, "<_>::foo", "<_>::foo");
6464
}
6565

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+
6686
fn check_prefix(entry: PrefixEntryPoint, input: &str, prefix: &str) {
6787
let lexed = LexedStr::new(input);
6888
let input = lexed.to_input();

0 commit comments

Comments
 (0)