add top level tests for types

This commit is contained in:
Aleksey Kladov 2022-01-02 17:45:18 +03:00
parent e78424846e
commit 640cc27ff0
3 changed files with 65 additions and 1 deletions

View file

@ -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);