From 7c4276b3e15a04c9f20d0ad56555a89ac8da2c74 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 1 Jan 2022 19:02:47 +0300 Subject: [PATCH] add path tests --- crates/parser/src/tests/entries.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/parser/src/tests/entries.rs b/crates/parser/src/tests/entries.rs index 7595c251be..1174e33f5f 100644 --- a/crates/parser/src/tests/entries.rs +++ b/crates/parser/src/tests/entries.rs @@ -53,6 +53,16 @@ fn expr() { check_prefix(PrefixEntryPoint::Expr, "#[attr] ()", "#[attr] ()"); } +#[test] +fn path() { + check_prefix(PrefixEntryPoint::Path, "foo::bar baz", "foo::bar"); + 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. + check_prefix(PrefixEntryPoint::Path, "<_>::foo", "<_>::foo"); +} + fn check_prefix(entry: PrefixEntryPoint, input: &str, prefix: &str) { let lexed = LexedStr::new(input); let input = lexed.to_input();