mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
add top level tests for types
This commit is contained in:
parent
e78424846e
commit
640cc27ff0
3 changed files with 65 additions and 1 deletions
|
@ -175,6 +175,55 @@ fn macro_pattern() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn type_() {
|
||||
check(
|
||||
TopEntryPoint::Type,
|
||||
"Option<!>",
|
||||
expect![[r#"
|
||||
PATH_TYPE
|
||||
PATH
|
||||
PATH_SEGMENT
|
||||
NAME_REF
|
||||
IDENT "Option"
|
||||
GENERIC_ARG_LIST
|
||||
L_ANGLE "<"
|
||||
TYPE_ARG
|
||||
NEVER_TYPE
|
||||
BANG "!"
|
||||
R_ANGLE ">"
|
||||
"#]],
|
||||
);
|
||||
check(
|
||||
TopEntryPoint::Type,
|
||||
"() () ()",
|
||||
expect![[r#"
|
||||
ERROR
|
||||
TUPLE_TYPE
|
||||
L_PAREN "("
|
||||
R_PAREN ")"
|
||||
WHITESPACE " "
|
||||
L_PAREN "("
|
||||
R_PAREN ")"
|
||||
WHITESPACE " "
|
||||
L_PAREN "("
|
||||
R_PAREN ")"
|
||||
"#]],
|
||||
);
|
||||
check(
|
||||
TopEntryPoint::Type,
|
||||
"$$$",
|
||||
expect![[r#"
|
||||
ERROR
|
||||
ERROR
|
||||
DOLLAR "$"
|
||||
DOLLAR "$"
|
||||
DOLLAR "$"
|
||||
error 0: expected type
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
fn check(entry: TopEntryPoint, input: &str, expect: expect_test::Expect) {
|
||||
let (parsed, _errors) = super::parse(entry, input);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue