aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion/src/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_completion/src/tests.rs')
-rw-r--r--crates/ide_completion/src/tests.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/crates/ide_completion/src/tests.rs b/crates/ide_completion/src/tests.rs
index 211c89c40..97298ff27 100644
--- a/crates/ide_completion/src/tests.rs
+++ b/crates/ide_completion/src/tests.rs
@@ -7,6 +7,10 @@
7mod item_list; 7mod item_list;
8mod use_tree; 8mod use_tree;
9mod items; 9mod items;
10mod pattern;
11mod type_pos;
12
13use std::mem;
10 14
11use hir::{PrefixKind, Semantics}; 15use hir::{PrefixKind, Semantics};
12use ide_db::{ 16use ide_db::{
@@ -45,7 +49,16 @@ pub(crate) fn completion_list(code: &str) -> String {
45} 49}
46 50
47fn completion_list_with_config(config: CompletionConfig, code: &str) -> String { 51fn completion_list_with_config(config: CompletionConfig, code: &str) -> String {
48 render_completion_list(get_all_items(config, code)) 52 // filter out all but one builtintype completion for smaller test outputs
53 let items = get_all_items(config, code);
54 let mut bt_seen = false;
55 let items = items
56 .into_iter()
57 .filter(|it| {
58 it.completion_kind != CompletionKind::BuiltinType || !mem::replace(&mut bt_seen, true)
59 })
60 .collect();
61 render_completion_list(items)
49} 62}
50 63
51/// Creates analysis from a multi-file fixture, returns positions marked with $0. 64/// Creates analysis from a multi-file fixture, returns positions marked with $0.