mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
internal: add more prefix entry point tests
This commit is contained in:
parent
9c210a49b6
commit
e36f557e4d
1 changed files with 21 additions and 1 deletions
|
@ -59,10 +59,30 @@ fn path() {
|
|||
check_prefix(PrefixEntryPoint::Path, "foo::<> baz", "foo::<>");
|
||||
check_prefix(PrefixEntryPoint::Path, "foo<> baz", "foo<>");
|
||||
check_prefix(PrefixEntryPoint::Path, "Fn() -> i32?", "Fn() -> i32");
|
||||
// FIXME: this shouldn't be accepted as path actually.
|
||||
// FIXME: This shouldn't be accepted as path actually.
|
||||
check_prefix(PrefixEntryPoint::Path, "<_>::foo", "<_>::foo");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn item() {
|
||||
// FIXME: This shouldn't consume the semicolon.
|
||||
check_prefix(PrefixEntryPoint::Item, "fn foo() {};", "fn foo() {};");
|
||||
check_prefix(PrefixEntryPoint::Item, "#[attr] pub struct S {} 92", "#[attr] pub struct S {}");
|
||||
check_prefix(PrefixEntryPoint::Item, "item!{}?", "item!{}");
|
||||
check_prefix(PrefixEntryPoint::Item, "????", "?");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn meta_item() {
|
||||
check_prefix(PrefixEntryPoint::MetaItem, "attr, ", "attr");
|
||||
check_prefix(
|
||||
PrefixEntryPoint::MetaItem,
|
||||
"attr(some token {stream});",
|
||||
"attr(some token {stream})",
|
||||
);
|
||||
check_prefix(PrefixEntryPoint::MetaItem, "path::attr = 2 * 2!", "path::attr = 2 * 2");
|
||||
}
|
||||
|
||||
fn check_prefix(entry: PrefixEntryPoint, input: &str, prefix: &str) {
|
||||
let lexed = LexedStr::new(input);
|
||||
let input = lexed.to_input();
|
||||
|
|
Loading…
Reference in a new issue