diff options
author | Timo Freiberg <[email protected]> | 2020-04-25 15:57:59 +0100 |
---|---|---|
committer | Timo Freiberg <[email protected]> | 2020-05-08 16:12:18 +0100 |
commit | fe93675e8ac2b55d051156151489dbe0496efec3 (patch) | |
tree | d01e03cd79aff92b553a25ba58b2e4b95262ab5d /crates/ra_hir_ty/src/tests | |
parent | d3eb9d8eafbebca7da95fa8a4813b92eb5080500 (diff) |
New HirDisplay method for displaying sourcecode
Diffstat (limited to 'crates/ra_hir_ty/src/tests')
-rw-r--r-- | crates/ra_hir_ty/src/tests/display_source_code.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/tests/display_source_code.rs b/crates/ra_hir_ty/src/tests/display_source_code.rs new file mode 100644 index 000000000..ca1748615 --- /dev/null +++ b/crates/ra_hir_ty/src/tests/display_source_code.rs | |||
@@ -0,0 +1,23 @@ | |||
1 | use super::displayed_source_at_pos; | ||
2 | use crate::test_db::TestDB; | ||
3 | use ra_db::fixture::WithFixture; | ||
4 | |||
5 | #[test] | ||
6 | fn qualify_path_to_submodule() { | ||
7 | let (db, pos) = TestDB::with_position( | ||
8 | r#" | ||
9 | //- /main.rs | ||
10 | |||
11 | mod foo { | ||
12 | pub struct Foo; | ||
13 | } | ||
14 | |||
15 | fn bar() { | ||
16 | let foo: foo::Foo = foo::Foo; | ||
17 | foo<|> | ||
18 | } | ||
19 | |||
20 | "#, | ||
21 | ); | ||
22 | assert_eq!("foo::Foo", displayed_source_at_pos(&db, pos)); | ||
23 | } | ||