From c22ccd07fecb964b11cba283d5ab184967c2669b Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Sun, 23 May 2021 00:37:15 +0200 Subject: ItemTree: pretty-print all paths --- crates/hir_def/src/item_tree/tests.rs | 46 +++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'crates/hir_def/src/item_tree/tests.rs') diff --git a/crates/hir_def/src/item_tree/tests.rs b/crates/hir_def/src/item_tree/tests.rs index 100ae9b97..91c44362e 100644 --- a/crates/hir_def/src/item_tree/tests.rs +++ b/crates/hir_def/src/item_tree/tests.rs @@ -242,3 +242,49 @@ m!(); "#]], ); } + +#[test] +fn mod_paths() { + check( + r#" +struct S { + a: self::Ty, + b: super::SuperTy, + c: super::super::SuperSuperTy, + d: ::abs::Path, + e: crate::Crate, + f: plain::path::Ty, +} + "#, + expect![[r#" + pub(self) struct S { + pub(self) a: self::Ty, + pub(self) b: super::SuperTy, + pub(self) c: super::super::SuperSuperTy, + pub(self) d: ::abs::Path, + pub(self) e: crate::Crate, + pub(self) f: plain::path::Ty, + } + "#]], + ) +} + +#[test] +fn types() { + check( + r#" +struct S { + a: Mixed<'a, T, Item=(), OtherItem=u8>, + b: ::Syntax, + c: ::Path::<'a>, +} + "#, + expect![[r#" + pub(self) struct S { + pub(self) a: Mixed<'a, T, Item = (), OtherItem = u8>, + pub(self) b: Qualified::Syntax, + pub(self) c: ::Path<'a>, + } + "#]], + ) +} -- cgit v1.2.3