mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
add expr tests
This commit is contained in:
parent
58fa7ce782
commit
287e748aa9
2 changed files with 29 additions and 1 deletions
|
@ -33,7 +33,7 @@ fn stmt() {
|
|||
fn pat() {
|
||||
check_prefix(PrefixEntryPoint::Pat, "x y", "x");
|
||||
check_prefix(PrefixEntryPoint::Pat, "fn f() {}", "fn");
|
||||
// FIXME: this one is wrong
|
||||
// FIXME: This one is wrong, we should consume only one pattern.
|
||||
check_prefix(PrefixEntryPoint::Pat, ".. ..", ".. ..");
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,15 @@ fn ty() {
|
|||
check_prefix(PrefixEntryPoint::Ty, "struct f", "struct");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn expr() {
|
||||
check_prefix(PrefixEntryPoint::Expr, "92 92", "92");
|
||||
check_prefix(PrefixEntryPoint::Expr, "+1", "+");
|
||||
check_prefix(PrefixEntryPoint::Expr, "-1", "-1");
|
||||
check_prefix(PrefixEntryPoint::Expr, "fn foo() {}", "fn");
|
||||
check_prefix(PrefixEntryPoint::Expr, "#[attr] ()", "#[attr] ()");
|
||||
}
|
||||
|
||||
fn check_prefix(entry: PrefixEntryPoint, input: &str, prefix: &str) {
|
||||
let lexed = LexedStr::new(input);
|
||||
let input = lexed.to_input();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue